From 67b81fe837b0b4ef9045d3d9e8205666aaf65268 Mon Sep 17 00:00:00 2001 From: kurrutako <86527917+kurrutako@users.noreply.github.com> Date: Wed, 25 Nov 2026 10:42:58 +0100 Subject: [PATCH] tests/run_wine_tests: one timing log per child, so --jobs tests pass 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/.log and intervals() reads them all. Co-Authored-By: Claude Opus 5.5 --- tests/test_run_wine_tests.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/test_run_wine_tests.py b/tests/test_run_wine_tests.py index 7ba55d2f8e..8cc7151be7 100644 --- a/tests/test_run_wine_tests.py +++ b/tests/test_run_wine_tests.py @@ -601,7 +601,11 @@ def test_no_wineserver_is_one_line_and_the_run_goes_on(self): self.assertIn("[PASS] ok", out) def timed(self, name, *, props=None, code=0, sleep=0.3): - """A test that logs when it starts and ends, to see which tests overlapped.""" + """A test that logs when it starts and ends, to see which tests overlapped. Each test has its own log: + appends from several processes to one file are not atomic on Windows, so a shared log loses or merges + lines when tests run at the same time.""" + timing = self.root / "timing" + timing.mkdir(exist_ok=True) (self.artifact / f"{name}.py").write_text( "import os, sys, time\n" "log = os.environ['TIMING_LOG']\n" @@ -610,14 +614,15 @@ def timed(self, name, *, props=None, code=0, sleep=0.3): f"open(log, 'a').write('{name} end %r\\n' % time.monotonic())\n" f"sys.exit({code})\n", encoding="utf-8", newline="\n") props = dict(props or {}) - props["ENVIRONMENT"] = ["TIMING_LOG=" + str(self.root / "timing.log")] + props["ENVIRONMENT"] = ["TIMING_LOG=" + str(timing / f"{name}.log")] return ctest_entry(name, self.command(f"{name}.py"), props) def intervals(self): spans: dict[str, list[float]] = {} - for line in (self.root / "timing.log").read_text(encoding="utf-8").splitlines(): - name, _, when = line.split() - spans.setdefault(name, []).append(float(when)) + for log in sorted((self.root / "timing").glob("*.log")): + for line in log.read_text(encoding="utf-8").splitlines(): + name, _, when = line.split() + spans.setdefault(name, []).append(float(when)) return spans @staticmethod