upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts/run_wine_tests.py
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 15:10:36 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 15:10:36 -0500
commit1bc49f49ce103b9eb3ce03b785b0916a4ebc8ac1 (patch)
tree4c8eb6e5aa28f31ffcf0c8f0b7c0cde9cae4d83a /scripts/run_wine_tests.py
parentf923223b61e87d5b595bb00f11fbb43fd94ccef0 (diff)
parent54e13c51b7d42e86d1eefc570f9ce1f56fc88cc3 (diff)
Merge pull request #2357 from Matheus Gomes
Diffstat (limited to 'scripts/run_wine_tests.py')
-rw-r--r--scripts/run_wine_tests.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py
index 9154dea48..53fa7bacd 100644
--- a/scripts/run_wine_tests.py
+++ b/scripts/run_wine_tests.py
@@ -14,6 +14,7 @@ runtime/build/generated). For those, the drive of --windows-root is pointed at -
14 14
15Every test is run and reported. The exit code is 1 if a test named by --require fails or is missing, else 0: the 15Every test is run and reported. The exit code is 1 if a test named by --require fails or is missing, else 0: the
16others show what does and doesn't work under Wine yet without failing the job. 16others show what does and doesn't work under Wine yet without failing the job.
17--timeout caps each process; a shorter positive CTest TIMEOUT takes precedence for that test.
17""" 18"""
18import argparse 19import argparse
19import json 20import json
@@ -149,13 +150,23 @@ def run_test(test: dict, args, wine: list[str]) -> tuple[str, str]:
149 if not key or not equals or "\0" in assignment: 150 if not key or not equals or "\0" in assignment:
150 return "fail", "invalid CTest ENVIRONMENT entry: expected NAME=value" 151 return "fail", "invalid CTest ENVIRONMENT entry: expected NAME=value"
151 env[key] = value 152 env[key] = value
153 timeout = args.timeout
154 if "TIMEOUT" in props:
155 try:
156 ctest_timeout = float(props["TIMEOUT"])
157 except (TypeError, ValueError):
158 return "fail", "invalid CTest TIMEOUT"
159 if not math.isfinite(ctest_timeout) or ctest_timeout < 0:
160 return "fail", "invalid CTest TIMEOUT"
161 if ctest_timeout > 0:
162 timeout = min(timeout, ctest_timeout)
152 start = time.monotonic() 163 start = time.monotonic()
153 try: 164 try:
154 proc = subprocess.run(argv, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, 165 proc = subprocess.run(argv, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
155 timeout=args.timeout) 166 timeout=timeout)
156 except subprocess.TimeoutExpired as e: 167 except subprocess.TimeoutExpired as e:
157 out = (e.stdout or b"").decode("utf-8", "replace") 168 out = (e.stdout or b"").decode("utf-8", "replace")
158 return "fail", f"timed out after {args.timeout} s\n{out}" 169 return "fail", f"timed out after {timeout} s\n{out}"
159 except OSError as e: # a mistyped --wine, or a missing one: report the test, do not abort the run 170 except OSError as e: # a mistyped --wine, or a missing one: report the test, do not abort the run
160 return "fail", f"could not start {argv[0]}: {e.strerror or e}" 171 return "fail", f"could not start {argv[0]}: {e.strerror or e}"
161 elapsed = time.monotonic() - start 172 elapsed = time.monotonic() - start
@@ -230,7 +241,8 @@ def main() -> int:
230 ap.add_argument("--wine", type=wine_command, default=os.environ.get("WINE", "wine"), 241 ap.add_argument("--wine", type=wine_command, default=os.environ.get("WINE", "wine"),
231 help="Wine command (default: $WINE or wine)") 242 help="Wine command (default: $WINE or wine)")
232 ap.add_argument("--require", action="append", default=[], help="a test that must pass (repeatable)") 243 ap.add_argument("--require", action="append", default=[], help="a test that must pass (repeatable)")
233 ap.add_argument("--timeout", type=positive_seconds, default=120.0, help="seconds per test (default 120)") 244 ap.add_argument("--timeout", type=positive_seconds, default=120.0,
245 help="maximum seconds per test; a shorter CTest TIMEOUT applies (default 120)")
234 ap.add_argument("--summary", help="append a Markdown table to this file (e.g. $GITHUB_STEP_SUMMARY)") 246 ap.add_argument("--summary", help="append a Markdown table to this file (e.g. $GITHUB_STEP_SUMMARY)")
235 ap.add_argument("--label", help="named in the summary's heading, e.g. the Wine version") 247 ap.add_argument("--label", help="named in the summary's heading, e.g. the Wine version")
236 args = ap.parse_args() 248 args = ap.parse_args()