test(pm): route build-deps PowerShell checks through the cold-runner helper

test_openssl_installs_once_and_rejects_damaged_shared_install and
test_native_build_command_preserves_failures_and_spaces each carried an
inline copy of the _powershell invocation with the pre-330ff28d44 30s
timeout. 330ff28d44 already established that a real powershell.exe child
on a cold CI runner can exceed 30s and raised the shared helper to 180s,
but these duplicated call sites kept the stale budget and timed out
intermittently on the windows-latest-32-arm-core lane.

Both now call _powershell(script, HELPER, tmp_path): identical argv and
environment construction (the inline setdefault calls were no-ops on
Windows), with the helper's documented cold-runner budget. No product
script changes.
This commit is contained in:
Hermes Agent
2026-09-25 16:09:23 -05:00
committed by brooklyn!
parent 6e901fca78
commit 5838f13725

View File

@@ -272,13 +272,11 @@ try { Install-HermesArm64OpenSSL -Vcpkg 'fixture-vcpkg' -Root $Root } catch {
if (-not $rejected -or $calls -ne 2) { throw 'damaged install was accepted' }
Write-Output 'PASS'
''', encoding="utf-8")
env = dict(os.environ)
env.setdefault("SystemRoot", r"C:\Windows")
shell = shutil.which("powershell") or str(Path(env["SystemRoot"]) / "System32/WindowsPowerShell/v1.0/powershell.exe")
result = subprocess.run(
[shell, "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", str(script), str(HELPER), str(tmp_path)],
capture_output=True, text=True, encoding="utf-8", errors="replace", env=env, timeout=30,
)
# Real PowerShell child: routed through _powershell like the rest of this
# file. Its 180s budget exists because a real powershell.exe on a cold
# CI runner can exceed 30s (330ff28d44); these inline copies kept the old
# 30s timeout and timed out on cold ARM64 runners.
result = _powershell(script, HELPER, tmp_path)
assert result.returncode == 0, result.stdout + result.stderr
assert "PASS" in result.stdout
@@ -315,14 +313,7 @@ $executable = $resolved
if ($executable -isnot [string] -or $executable.Contains(' ')) { throw "joined path leaked: $executable" }
Write-Output 'PASS'
''', encoding="utf-8")
env = dict(os.environ)
env.setdefault("SystemRoot", r"C:\Windows")
env.setdefault("ComSpec", str(Path(env["SystemRoot"]) / "System32/cmd.exe"))
env.setdefault("PATHEXT", ".COM;.EXE;.BAT;.CMD")
shell = shutil.which("powershell") or str(Path(env["SystemRoot"]) / "System32/WindowsPowerShell/v1.0/powershell.exe")
result = subprocess.run(
[shell, "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", str(script), str(HELPER), str(tmp_path)],
capture_output=True, text=True, encoding="utf-8", errors="replace", env=env, timeout=30,
)
# Same as above: the shared helper's cold-runner budget, not a stale 30s copy.
result = _powershell(script, HELPER, tmp_path)
assert result.returncode == 0, result.stdout + result.stderr
assert "PASS" in result.stdout