test(windows): forward PSModuleAnalysisCachePath to the test processes

The hosted Windows images point PowerShell at a shared module analysis cache,
which the job's earlier PowerShell steps (the ARM64 build-deps setup) warm.
run_tests.sh starts the suite from env -i and did not forward the variable, so
every powershell.exe a test spawned fell back to a cold per-user cache and
re-analysed every installed module (Az, AWS, Graph): about 22s per launch on the
arm64 runners. The three slowest Windows files (150-167s each) were almost all
that wait.
This commit is contained in:
kshitijk4poor
2026-11-03 04:43:19 +05:30
committed by kshitij
parent 785e6b9cf2
commit 5de2f3038d

View File

@@ -138,12 +138,16 @@ fi
# and tempfile needs TEMP/TMP. Dropping them breaks collection on native
# Windows (issues #67385, #70813). PATHEXT is also required: without .EXE,
# PowerShell opens a native child as a document without waiting for its exit.
# PSModuleAnalysisCachePath: the hosted Windows images point PowerShell at a
# shared module analysis cache, which the job's earlier PowerShell steps warm.
# Without it a test's powershell.exe child falls back to a cold per-user cache
# and re-analyses every installed module (~22s per launch on arm64 runners).
# These are location variables, not
# credentials, so forwarding them keeps the isolation intent intact. Each is
# only forwarded when actually set, so POSIX runs are byte-for-byte unchanged.
WIN_ENV=()
for _win_var in USERPROFILE HOMEDRIVE HOMEPATH LOCALAPPDATA APPDATA SYSTEMROOT TEMP TMP \
ComSpec PATHEXT PROGRAMFILES ProgramFiles PROGRAMDATA ProgramData; do
ComSpec PATHEXT PROGRAMFILES ProgramFiles PROGRAMDATA ProgramData PSModuleAnalysisCachePath; do
if [ -n "${!_win_var:-}" ]; then
WIN_ENV+=("$_win_var=${!_win_var}")
fi