Repository navigation
tests: each fake test of the --jobs tests logs to a file of its own (TEST-WINE-JOBS-TIMING-LOG) - #1410
tests: each fake test of the --jobs tests logs to a file of its own (TEST-WINE-JOBS-TIMING-LOG)#1410milk4sale wants to merge 1 commit into
Conversation
…TEST-WINE-JOBS-TIMING-LOG) tests/test_run_wine_tests.py fails on Windows since ProjectLeonida#1354 added the --jobs tests: in the check job's loop it failed in 2 of 4 runs on a windows-latest runner, in MainTest.test_jobs_keeps_locks_serial_tests_and_dependencies, once with "KeyError: 'after'" and once with "IndexError: list index out of range" in overlap(). It passes on Linux and macOS. The job's 15-minute limit cancels it before it prints its list of failed files, which is why nobody saw it. The fake test programs of those tests run several at a time, and each appended its "start" and "end" line to one timing.log with open(log, 'a').write(...). On Windows an append from another process is not atomic: both writers find the same end of file and one line replaces the other. A test whose lines are both lost is missing from the result (the KeyError), one that lost a line has a single timestamp (the IndexError, or "not enough values to unpack" in most_at_once), and a mangled line fails in intervals(). Each fake test now gets its own log (timing.<name>.log) and intervals() reads them all. The tests assert what they asserted before. Measured on GitHub's runners with Python 3.12 (a scratch branch on a fork, each system once): - four processes that append two lines each to one file at the same moment, 150 rounds: a line was lost in 150 rounds on windows-latest and in none on ubuntu-24.04 and macos-26; with a file per process, in none anywhere; - the two --jobs tests run 60 times: 60 failures on windows-latest before this change and none after; none before or after on ubuntu-24.04 and macos-26. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Reviewed 63be3a6: ran the full tests/test_run_wine_tests.py on my side (Linux), 72/72 pass on the PR and AI-assisted review. Recommendation: Merge |
|
Hi @milk4sale, thanks for this pull request. It currently conflicts with AI-assisted (Claude Code, Claude Opus 5.5). |
Claimed in the coordination issue as: TEST-WINE-JOBS-TIMING-LOG (#14 (comment))
What and why
tests/test_run_wine_tests.pyfails on Windows since #1354 added the--jobstests. In thecheckjob's loop on awindows-latestrunner it failed in 2 of the 4 runs that had the file, both times inMainTest.test_jobs_keeps_locks_serial_tests_and_dependencies: once withKeyError: 'after'and once withIndexError: list index out of rangeinoverlap(). It passes on Linux and macOS. Nobody saw it becausecheckis cancelled at its 15-minute limit before it prints its list of failed files (#1404).The cause is in the test, not in
scripts/run_wine_tests.py. The fake test programs of the two--jobstests run several at a time, and each appended itsstartandendline to one sharedtiming.logwithopen(log, 'a').write(...). On Windows an append from another process is not atomic: both writers find the same end of file and one line replaces the other. Then:KeyError);IndexError, ornot enough values to unpackinmost_at_once);intervals().Each fake test now logs to a file of its own (
timing.<name>.log), andintervals()reads them all. The tests assert exactly what they asserted before. Seven lines change in one test file.Tested
Measured on GitHub's runners with Python 3.12, one run per system, from a scratch branch on my fork whose workflow ran only this (run 45510380923):
windows-latestubuntu-24.04macos-26--jobstests run 60 times onmain's file: runs that failedThe first row is the cause measured on its own; a round on Windows typically kept 2 to 4 of its 8 lines. The scratch branch ran this change without the sentence I then added to
timed's docstring; the code is the same.In the full
checkloop the file failed in 2 of 4 runs (fork runs 45502632816 and 45506216167) and passed in 2, so there it is intermittent; run on their own the two tests failed every time.Locally, on Linux with Python 3.14.10:
python -I tests/test_run_wine_tests.py: 72 tests pass.--jobstests 20 times in a row: 20 pass.python -I scripts/check_no_game_data.py tests/test_run_wine_tests.pyandgit diff --check.Not run: Wine itself. The change is inside the test's fake programs and does not touch the runner.
GPUs tested: n/a (one Python test file)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator change.)🤖 Generated with Claude Code