@@ -54,11 +54,21 @@ printf 'export module gshape.helper;\nimport std;\nexport auto helper() -> int {
5454printf ' export module gshape.face;\nimport std;\nexport auto face() -> int { return 1; }\n' > src/face.ixx
5555printf ' import std;\nimport gshape.face;\nint main(){ std::println("{}", face()); }\n' > src/main.cpp
5656
57- fp_dir () { find target -name build.ninja -printf ' %h\n' | head -1; }
57+ # Ask mcpp for the fingerprint instead of inferring it from the build tree.
58+ #
59+ # ⚠️ The obvious `find target -name build.ninja | head -1` is WRONG here and was
60+ # flaky in exactly the way this test is meant to catch: after part 2 there are
61+ # TWO output dirs, and `head -1` picks whichever `find` happened to walk first.
62+ # It passed standalone and failed inside the suite. Assert on the value, not on
63+ # a directory listing.
64+ fingerprint () {
65+ " $MCPP " build --print-fingerprint 2>&1 | sed -n ' s/^Fingerprint: //p' | head -1
66+ }
5867
5968# ── 0. First build, then confirm the fast path actually engages ────────────
6069" $MCPP " build > b0.log 2>&1 || { cat b0.log; echo " FAIL: first build" ; exit 1; }
61- FP_BEFORE=" $( fp_dir) "
70+ FP_BEFORE=" $( fingerprint) "
71+ [ -n " $FP_BEFORE " ] || { echo " FAIL: could not read the fingerprint" ; exit 1; }
6272
6373" $MCPP " build > b1.log 2>&1 || { cat b1.log; echo " FAIL: no-change build" ; exit 1; }
6474grep -q " Compiling" b1.log && {
@@ -91,14 +101,14 @@ module_extensions = [".ixx", ".ccm"]
91101EOF
92102
93103" $MCPP " build > b3.log 2>&1 || { cat b3.log; echo " FAIL: build after key change" ; exit 1; }
94- FP_AFTER=" $( fp_dir ) "
104+ FP_AFTER=" $( fingerprint ) "
95105
96106[[ " $FP_BEFORE " != " $FP_AFTER " ]] || {
97107 echo " FAIL: module_extensions changed but the output dir did not"
98108 echo " before=$FP_BEFORE after=$FP_AFTER "
99109 echo " (the key is missing from the canonical compile-flags string)"
100110 exit 1; }
101- echo " ok: the key is fingerprinted ($( basename " $ FP_BEFORE" ) -> $( basename " $ FP_AFTER" ) )"
111+ echo " ok: the key is fingerprinted ($FP_BEFORE -> $FP_AFTER )"
102112
103113# ── 3. A dead entry is reported, not silently ignored ──────────────────────
104114#
0 commit comments