Skip to content

Commit 5ef25c1

Browse files
committed
test(e2e): read the cache root from mcpp, not from a bash re-derivation
170 asserted the staging source lived under ${MCPP_HOME:-$HOME/.mcpp}/build-cache/v1. That re-derivation is wrong for a SELF-CONTAINED install, where the unpacked tree itself is the home — the shape of every release tarball and every `xlings install mcpp`. Running the suite against the released 2026.7.30.2 binary therefore failed the test while the binary was correct: FAIL: std BMI cache is '<tarball>/build-cache/v1/std/...', expected under '/home/speak/.mcpp/build-cache/v1/std' CI never saw it because the binary under test lives at target/<triple>/<fp>/bin/mcpp, which mcpp.home::root() deliberately disqualifies from self-contained detection. The root now comes from `mcpp cache dir`, which exists precisely so "where is the cache" has one answer. Verified passing against both shapes: the released tarball binary and a dev build.
1 parent 3fec883 commit 5ef25c1

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

tests/e2e/170_bmi_staging_no_cascade.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# carried no `restat`, so every importer of `import std` rebuilt whenever
1010
# the cache-side BMI got a newer mtime (which happens on any cwd change
1111
# before the cache-root fix below).
12-
# 2. The staging SOURCE must live under $MCPP_HOME/build-cache/v1/std. That cache
12+
# 2. The staging SOURCE must live under the cache root mcpp itself reports. That cache
1313
# used to resolve its root through a private copy of the home logic that
1414
# knew neither %USERPROFILE% nor self-contained installs, so on Windows it
1515
# parked the cache in the current working directory as `.mcpp-bmi/`.
@@ -56,12 +56,22 @@ DST=$(unescape_ninja "$(echo "$EDGE" | awk '{print $2}')")
5656
SRC=$(unescape_ninja "$(echo "$EDGE" | awk '{print $NF}')")
5757
echo "staging: $SRC -> $DST"
5858

59-
# ── invariant 2: the cache root is $MCPP_HOME/build-cache/v1/std, never a cwd-local
60-
# dir (and never the pre-v1 $MCPP_HOME/bmi tree, which nothing reads now) ──
61-
HOME_ROOT=$(norm_path "${MCPP_HOME:-$HOME/.mcpp}")
59+
# ── invariant 2: the staging SOURCE lives under the tool's OWN cache root, and
60+
# never in a cwd-local directory (nor in the pre-v1 bmi/ tree, which nothing
61+
# reads now) ──
62+
#
63+
# The root is read from `mcpp cache dir` rather than re-derived here as
64+
# ${MCPP_HOME:-$HOME/.mcpp}/build-cache/v1. That re-derivation is wrong for a
65+
# SELF-CONTAINED install, where the unpacked tree itself is the home — which is
66+
# the shape of every release tarball and every `xlings install mcpp`. Re-deriving
67+
# it made this test fail against a released binary while the binary was right,
68+
# and "where is the cache" having two answers in two places is the exact defect
69+
# #311 spent a module (mcpp.home) removing.
70+
CACHE_ROOT=$(norm_path "$("$MCPP" cache dir | head -1)")
71+
[[ -n "$CACHE_ROOT" ]] || { echo "FAIL: mcpp cache dir printed nothing"; exit 1; }
6272
case "$(norm_path "$SRC")" in
63-
"$HOME_ROOT"/build-cache/v1/std/*) ;;
64-
*) echo "FAIL: std BMI cache is '$SRC', expected under '$HOME_ROOT/build-cache/v1/std'"
73+
"$CACHE_ROOT"/std/*) ;;
74+
*) echo "FAIL: std BMI cache is '$SRC', expected under '$CACHE_ROOT/std'"
6575
exit 1 ;;
6676
esac
6777
for leftover in "$TMP/.mcpp-bmi" "$TMP/app/.mcpp-bmi"; do

0 commit comments

Comments
 (0)