diff options
| author | Matheus Gomes <39656344+matheuskshn@users.noreply.github.com> | 2026-11-22 16:27:39 -0300 |
|---|---|---|
| committer | Matheus Gomes <39656344+matheuskshn@users.noreply.github.com> | 2026-11-22 16:27:39 -0300 |
| commit | 54e13c51b7d42e86d1eefc570f9ce1f56fc88cc3 (patch) | |
| tree | 824340eeb75e0795ad8b36699ffcef5b21a2cbf6 /scripts/run_wine_tests.py | |
| parent | 03d9ce780d8ce43d5d341a1ade0c6b864d061ec8 (diff) | |
| parent | 162821017ea3c286c8bec860f3ff94f037912061 (diff) | |
Merge upstream main into the Wine timeout fix
Keep the per-test CTest environment and pass its subprocess the more restrictive deadline.
Diffstat (limited to 'scripts/run_wine_tests.py')
| -rw-r--r-- | scripts/run_wine_tests.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py index e4fbdf1fa..5c16cfb16 100644 --- a/scripts/run_wine_tests.py +++ b/scripts/run_wine_tests.py | |||
| @@ -119,6 +119,9 @@ def regex_list(value: str | list[str]) -> list[str]: | |||
| 119 | 119 | ||
| 120 | def run_test(test: dict, args, wine: list[str]) -> tuple[str, str]: | 120 | def run_test(test: dict, args, wine: list[str]) -> tuple[str, str]: |
| 121 | """Returns (status, detail): status is pass, fail or skip.""" | 121 | """Returns (status, detail): status is pass, fail or skip.""" |
| 122 | props = properties(test) | ||
| 123 | if truthy(props.get("DISABLED")): | ||
| 124 | return "skip", "disabled by CTest" | ||
| 122 | command = test.get("command") | 125 | command = test.get("command") |
| 123 | if not command: | 126 | if not command: |
| 124 | return "fail", "no command (target not built?)" | 127 | return "fail", "no command (target not built?)" |
| @@ -132,11 +135,21 @@ def run_test(test: dict, args, wine: list[str]) -> tuple[str, str]: | |||
| 132 | for a in command[1:]: | 135 | for a in command[1:]: |
| 133 | mapped = map_path(a, args.windows_root, args.root) | 136 | mapped = map_path(a, args.windows_root, args.root) |
| 134 | argv.append(wine_path(mapped) if mapped is not None else a) | 137 | argv.append(wine_path(mapped) if mapped is not None else a) |
| 135 | props = properties(test) | ||
| 136 | cwd = props.get("WORKING_DIRECTORY") | 138 | cwd = props.get("WORKING_DIRECTORY") |
| 137 | cwd = map_path(cwd, args.windows_root, args.root) if cwd else os.path.dirname(exe) | 139 | cwd = map_path(cwd, args.windows_root, args.root) if cwd else os.path.dirname(exe) |
| 138 | if not cwd or not os.path.isdir(cwd): | 140 | if not cwd or not os.path.isdir(cwd): |
| 139 | cwd = os.path.dirname(exe) | 141 | cwd = os.path.dirname(exe) |
| 142 | assignments = props.get("ENVIRONMENT", []) | ||
| 143 | if not isinstance(assignments, list): | ||
| 144 | return "fail", "invalid CTest ENVIRONMENT: expected a list of NAME=value entries" | ||
| 145 | env = os.environ.copy() | ||
| 146 | for assignment in assignments: | ||
| 147 | if not isinstance(assignment, str): | ||
| 148 | return "fail", "invalid CTest ENVIRONMENT entry: expected NAME=value" | ||
| 149 | key, equals, value = assignment.partition("=") | ||
| 150 | if not key or not equals or "\0" in assignment: | ||
| 151 | return "fail", "invalid CTest ENVIRONMENT entry: expected NAME=value" | ||
| 152 | env[key] = value | ||
| 140 | timeout = args.timeout | 153 | timeout = args.timeout |
| 141 | if "TIMEOUT" in props: | 154 | if "TIMEOUT" in props: |
| 142 | try: | 155 | try: |
| @@ -149,7 +162,7 @@ def run_test(test: dict, args, wine: list[str]) -> tuple[str, str]: | |||
| 149 | timeout = min(timeout, ctest_timeout) | 162 | timeout = min(timeout, ctest_timeout) |
| 150 | start = time.monotonic() | 163 | start = time.monotonic() |
| 151 | try: | 164 | try: |
| 152 | proc = subprocess.run(argv, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, | 165 | proc = subprocess.run(argv, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, |
| 153 | timeout=timeout) | 166 | timeout=timeout) |
| 154 | except subprocess.TimeoutExpired as e: | 167 | except subprocess.TimeoutExpired as e: |
| 155 | out = (e.stdout or b"").decode("utf-8", "replace") | 168 | out = (e.stdout or b"").decode("utf-8", "replace") |