Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tests/test_run_wine_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ 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 has a log of its own: on
Windows, lines that several processes append to one file at the same moment overwrite each other."""
(self.artifact / f"{name}.py").write_text(
"import os, sys, time\n"
"log = os.environ['TIMING_LOG']\n"
Expand All @@ -610,14 +611,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(self.root / f"timing.{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.glob("timing.*.log")):
for line in log.read_text(encoding="utf-8").splitlines():
name, _, when = line.split()
spans.setdefault(name, []).append(float(when))
return spans

@staticmethod
Expand Down
Loading