Skip to content

tests/run_wine_tests: one timing log per child, so --jobs tests pass on Windows (TEST-WINE-JOBS-TIMING-WINDOWS) - #1722

Merged
Andretuta merged 1 commit into
ProjectLeonida:mainfrom
kurrutako:test/wine-jobs-timing-windows
Nov 27, 2026
Merged

Andretuta merged 1 commit into
ProjectLeonida:mainfrom
kurrutako:test/wine-jobs-timing-windows

Conversation

@kurrutako

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-WINE-JOBS-TIMING-WINDOWS (#1608 (comment))

What and why

On native Windows, test_jobs_runs_that_many_tests_at_a_time and test_jobs_keeps_locks_serial_tests_and_dependencies
in tests/test_run_wine_tests.py fail on every run, with IndexError (a span with no end) or ValueError (two lines
merged into one) in intervals().

The timed() child processes all append to one shared timing.log at the same time. Appends from several processes
to one file are not atomic on Windows, so lines are lost or merged. Reproduced outside the test: six processes doing
the same two appends to one file left 11 lines instead of 12.

The fix is in the test only: each child writes its own timing/<name>.log, and intervals() reads them all.
scripts/run_wine_tests.py is unchanged.

Tested

Windows 11, Python 3.14, on main 3de22a1:

  • python -I tests/test_run_wine_tests.py: before, FAILED (errors=2, skipped=12) on every run; after, OK (skipped=12) on 4 of 4 runs.
  • python -I tests/test_text_write_line_endings.py: OK.

Not run on Linux; the change does not depend on the platform.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a)

🤖 Generated with Claude Code

…on Windows (TEST-WINE-JOBS-TIMING-WINDOWS)

test_jobs_runs_that_many_tests_at_a_time and test_jobs_keeps_locks_serial_tests_and_dependencies failed on every native Windows run with IndexError or ValueError in intervals(). The timed() children appended to one shared timing.log at the same time; appends from several processes are not atomic on Windows, so lines were lost or merged. Each child now writes timing/<name>.log and intervals() reads them all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent A/B at 67b81fe8 against 3de22a19, with synthetic subprocesses.

  • Native Windows, Python 3.12.1, four runs of tests/test_run_wine_tests.py -k test_jobs: the base failed all four runs with incomplete or malformed timing records. The PR passed all four runs. The full Windows file passed (60 tests reported, 12 skips).
  • Ubuntu under WSL, Python 3.10.12: all four test_jobs tests passed on the PR. The full-file runs exposed two pre-existing uses of Python 3.11's contextlib.chdir on both revisions. The two timing tests also failed on the base with the scratch directory on a Windows-mounted volume.

AI-assisted testing. CPU only, no GPU or game data.

@kurrutako

kurrutako commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Independent A/B at 67b81fe8 against 3de22a19, with synthetic subprocesses.

  • Native Windows, Python 3.12.1, four runs of tests/test_run_wine_tests.py -k test_jobs: the base failed all four runs with incomplete or malformed timing records. The PR passed all four runs. The full Windows file passed (60 tests reported, 12 skips).
  • Ubuntu under WSL, Python 3.10.12: all four test_jobs tests passed on the PR. The full-file runs exposed two pre-existing uses of Python 3.11's contextlib.chdir on both revisions. The two timing tests also failed on the base with the scratch directory on a Windows-mounted volume.

AI-assisted testing. CPU only, no GPU or game data.

Thanks for the independent A/B on Windows and WSL. The WSL volume result matches the cause: appends from several processes aren't reliable on Windows file systems. The contextlib.chdir failures are pre-existing and Python 3.10 is below the project's 3.12 minimum, so I've left them out of this PR.

@OguzSoykan

Copy link
Copy Markdown

Verified on native Windows at head 67b81fe83: tests/test_run_wine_tests.py errors on main in test_jobs_runs_that_many_tests_at_a_time and test_jobs_keeps_locks_serial_tests_and_dependencies (the shared timing log loses lines, IndexError / ValueError: not enough values to unpack) and passes here (72 tests, OK, 12 skipped).

Native Windows 10 Pro 19045, CPython 3.12, py -3.12 -I, checkout under a non-ASCII profile path (C:\Users\Oğuz\..., TEMP is the 8.3 alias C:\Users\OUZ~1\...). No game files.

AI-assisted (Claude Code).

@DanielMarcos1

Copy link
Copy Markdown

Independent verification on native Windows with Python 3.13.17, using the exact test fixture from PR head 67b81fe837b0b4ef9045d3d9e8205666aaf65268 with the local runner at e5a7c8942.

  • Full tests/test_run_wine_tests.py suite: 60 passed, 12 skipped.
  • Repeated the worker-count test and the resource-lock/serial/dependency test 10 times each: 20 of 20 passed.
  • For comparison, the two tests produced 5 errors in 16 runs with the shared log on the same machine. One captured log contained a blank line and was missing a child’s end record.

No game files or GPU were used. Test verification was AI-assisted with Codex.

@Andretuta

Copy link
Copy Markdown
Collaborator

Both --jobs timing cases errored on native Windows at main d1dff7949. With 67b81fe83 in the local CI integration and #2193's two-worker runner, test_run_wine_tests.py completed with 60 passes and 12 skips. This was one local run.

AI-assisted testing.

@Andretuta
Andretuta merged commit 57181ac into ProjectLeonida:main Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants