Skip to content

Commit 5ae8d8a

Browse files
committed
fix(e2e/ci): run msvc detection assertions from a neutral cwd
toolchain list stars the *effective* default; the repo root's mcpp.toml [toolchain] windows=llvm@20.1.7 would shadow the freshly-set global msvc@system when run_all.sh executes from the workspace.
1 parent 37672d2 commit 5ae8d8a

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/ci-windows.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ jobs:
238238
run: |
239239
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
240240
241+
# Neutral cwd: the repo root's mcpp.toml [toolchain] would shadow
242+
# the global default in `toolchain list` / doctor output.
243+
TMP=$(mktemp -d); cd "$TMP"
244+
241245
out=$("$MCPP_SELF" toolchain default msvc); echo "$out"
242246
grep -q "Detected" <<<"$out"
243247
grep -q "msvc@system" <<<"$out"
@@ -249,7 +253,6 @@ jobs:
249253
grep -qi "msvc" doctor.txt
250254
251255
# native cl.exe builds are gated with one owned message
252-
TMP=$(mktemp -d); cd "$TMP"
253256
"$MCPP_SELF" new hello_msvc && cd hello_msvc
254257
set +e
255258
bout=$("$MCPP_SELF" build 2>&1); brc=$?

tests/e2e/95_msvc_system_toolchain.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ restore() {
2626
}
2727
trap restore EXIT
2828

29+
# Neutral cwd: `toolchain list` stars the *effective* default, and a project
30+
# mcpp.toml [toolchain] in the cwd (e.g. the mcpp repo root, where run_all.sh
31+
# executes) would shadow the global default we're about to set.
32+
cd "$TMP"
33+
2934
# 1) switch to msvc: detect + identify + persist
3035
out=$("$MCPP" toolchain default msvc 2>&1) || { echo "FAIL: default msvc: $out"; exit 1; }
3136
[[ "$out" == *"Detected"* ]] || { echo "FAIL: no Detected line: $out"; exit 1; }
@@ -54,7 +59,6 @@ out=$("$MCPP" toolchain install msvc 2>&1) \
5459
|| { echo "FAIL: install msvc message: $out"; exit 1; }
5560

5661
# 5) native cl.exe builds are gated with one owned message
57-
cd "$TMP"
5862
"$MCPP" new hello_msvc >/dev/null 2>&1
5963
cd hello_msvc
6064
rc=0; out=$("$MCPP" build 2>&1) || rc=$?

0 commit comments

Comments
 (0)