From 930cc3cc6741b5dbc4b1aab23907c3cebb43d31a Mon Sep 17 00:00:00 2001 From: jdalton Date: Sat, 1 Aug 2026 11:05:39 -0400 Subject: [PATCH] test(setup-matrix): give each case its own home directory run-case.sh isolated only XDG_CACHE_HOME, so every package manager it drives resolved its cache, store and credentials from the caller's real home. Under `setup-matrix.sh run --host` that is the developer's own home directory. Each case now gets HOME inside its per-case WORKDIR, along with the variables that outrank HOME for their tools (CARGO_HOME, GOPATH, GOMODCACHE, GOCACHE, PNPM_HOME, COREPACK_HOME, NUGET_PACKAGES and the remaining XDG dirs). The verification helpers read through those same variables, so they keep resolving without changes. --- tests/setup_matrix/run-case.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/setup_matrix/run-case.sh b/tests/setup_matrix/run-case.sh index 913d10b3..d294a5d4 100755 --- a/tests/setup_matrix/run-case.sh +++ b/tests/setup_matrix/run-case.sh @@ -664,6 +664,24 @@ export SOCKET_TELEMETRY_DISABLED=1 SOCKET_EXPERIMENTAL_MAVEN=1 SOCKET_EXPERIMENT # Isolate the pypi `.pth` hook's change-detection stamp per case so runs # don't bleed into each other (the stamp lives under XDG_CACHE_HOME). export XDG_CACHE_HOME="$WORKDIR/.cache" +# Give the case its own home so every package manager's cache, store and +# credentials stay inside WORKDIR. Under `--host` these run on the +# developer's machine, where the default is their real home. The vars +# below outrank HOME for their tools, so they are pointed inside it +# rather than left to leak. +# +# RUSTUP_HOME is the exception: rustup's toolchains live under the real +# home (defaulting to $HOME/.rustup when unset) and are shared, not +# per-case. Pin it to that location BEFORE HOME is redirected, or rustup +# resolves toolchains under the empty fake home and `cargo fetch` fails +# even though CARGO_HOME is set. An already-exported RUSTUP_HOME (e.g. the +# cargo Docker image) is preserved. +export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" +mkdir -p "$WORKDIR/home" +export HOME="$WORKDIR/home" +export XDG_DATA_HOME="$WORKDIR/home/.local/share" XDG_CONFIG_HOME="$WORKDIR/home/.config" XDG_STATE_HOME="$WORKDIR/home/.local/state" +export CARGO_HOME="$WORKDIR/home/.cargo" GOPATH="$WORKDIR/home/go" GOMODCACHE="$WORKDIR/home/go/pkg/mod" GOCACHE="$WORKDIR/home/.cache/go-build" +export PNPM_HOME="$WORKDIR/home/.pnpm" COREPACK_HOME="$WORKDIR/home/.corepack" NUGET_PACKAGES="$WORKDIR/home/.nuget/packages" # NOTE: deliberately do NOT export SOCKET_CWD. The install hook's apply # must run with whatever cwd the package manager sets for the lifecycle # script — the project root for a single project, and the *member* dir