diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 17:08:47 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 17:08:47 +0100 |
| commit | bdfe5f88ec7f8f061d43f3be897c44bb0b54f668 (patch) | |
| tree | 6c11d861a1c8fafb074f3b24d4ddf5a194c03bc4 /scripts/run_wine_tests.py | |
| parent | 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff) | |
fix(wine): apply each CTest test environment
A test-specific setting can select a different adapter or feature. Pass the CTest environment to its subprocess so Wine covers the same settings and sibling tests still inherit the runner environment.
Diffstat (limited to 'scripts/run_wine_tests.py')
| -rw-r--r-- | scripts/run_wine_tests.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/scripts/run_wine_tests.py b/scripts/run_wine_tests.py index 0a02525e5..4cf8485f3 100644 --- a/scripts/run_wine_tests.py +++ b/scripts/run_wine_tests.py | |||
| @@ -136,9 +136,20 @@ def run_test(test: dict, args, wine: list[str]) -> tuple[str, str]: | |||
| 136 | cwd = map_path(cwd, args.windows_root, args.root) if cwd else os.path.dirname(exe) | 136 | cwd = map_path(cwd, args.windows_root, args.root) if cwd else os.path.dirname(exe) |
| 137 | if not cwd or not os.path.isdir(cwd): | 137 | if not cwd or not os.path.isdir(cwd): |
| 138 | cwd = os.path.dirname(exe) | 138 | cwd = os.path.dirname(exe) |
| 139 | assignments = props.get("ENVIRONMENT", []) | ||
| 140 | if not isinstance(assignments, list): | ||
| 141 | return "fail", "invalid CTest ENVIRONMENT: expected a list of NAME=value entries" | ||
| 142 | env = os.environ.copy() | ||
| 143 | for assignment in assignments: | ||
| 144 | if not isinstance(assignment, str): | ||
| 145 | return "fail", "invalid CTest ENVIRONMENT entry: expected NAME=value" | ||
| 146 | key, equals, value = assignment.partition("=") | ||
| 147 | if not key or not equals or "\0" in assignment: | ||
| 148 | return "fail", "invalid CTest ENVIRONMENT entry: expected NAME=value" | ||
| 149 | env[key] = value | ||
| 139 | start = time.monotonic() | 150 | start = time.monotonic() |
| 140 | try: | 151 | try: |
| 141 | proc = subprocess.run(argv, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, | 152 | proc = subprocess.run(argv, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, |
| 142 | timeout=args.timeout) | 153 | timeout=args.timeout) |
| 143 | except subprocess.TimeoutExpired as e: | 154 | except subprocess.TimeoutExpired as e: |
| 144 | out = (e.stdout or b"").decode("utf-8", "replace") | 155 | out = (e.stdout or b"").decode("utf-8", "replace") |