Skip to content

Commit 68f18af

Browse files
committed
test(e2e): accept either build verb where a dependency may come from the cache
Fallout from making the global cache work, and one of the two is a negative assertion my change silently weakened. 163 asserted `Compiling acme.widget`. What it tests is that the descriptor was found BY IDENTITY and the package joined the build; whether its objects were compiled here or served from the cache belongs to a different subsystem. Now that hits actually skip work, a sibling app dir under the same MCPP_HOME — 163 builds several — can legitimately supply them, which is how it failed on Windows CI: Cached acme.widget v1.38.1 (2 units) FAIL: 163_identity_first_resolution.sh 82 is the more important one. Its NEGATIVE check ("widget must not be pulled when the feature is inactive") grepped only `Compiling widget`, so a wrongly-pulled dependency whose objects happened to be cached would announce `Cached widget` and pass. Both directions now match either verb through one `pulled()` helper, so the positive cannot be too narrow and the negative cannot be too weak. 25 and 48 grep the ROOT package's Compiling line, which is never cached; left alone.
1 parent 5ef25c1 commit 68f18af

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

tests/e2e/163_identity_first_resolution.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ EOF
7878
mkidx idx1 a/acme.widget.lua acme widget
7979
mkapp app1 acme ../idx1 acme widget
8080
(cd app1 && "$MCPP" build > out.txt 2>&1) || { cat app1/out.txt; exit 1; }
81-
grep -q "Compiling acme.widget" app1/out.txt || { cat app1/out.txt; exit 1; }
81+
# Either verb: what this test is about is that the descriptor was found BY
82+
# IDENTITY and the package became part of the build. Whether its objects were
83+
# compiled here or served from the global build cache is a different subsystem's
84+
# business — and now that the cache actually works, a sibling app dir under the
85+
# same MCPP_HOME (or a restored CI sandbox) can legitimately supply them.
86+
grep -qE "(Compiling|Cached) acme\.widget" app1/out.txt || {
87+
cat app1/out.txt
88+
echo "FAIL: acme.widget was neither compiled nor served from cache"
89+
exit 1
90+
}
8291
# xlings names the dir {namespace}-x-{literal name} — short name → acme-x-widget
8392
test -d "app1/.mcpp/.xlings/data/xpkgs/acme-x-widget" \
8493
|| { echo "FAIL: expected store dir acme-x-widget"; ls -R app1/.mcpp/.xlings/data/xpkgs 2>/dev/null; exit 1; }

tests/e2e/82_feature_optional_deps.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,22 @@ EOF
4646

4747
cd app
4848

49-
# 1. Feature inactive → widget is NOT pulled (never resolved/compiled).
49+
# Both directions match EITHER verb. A dependency that is in the graph announces
50+
# itself as `Compiling` or, when the global build cache supplies its objects, as
51+
# `Cached` — so "Compiling" alone is too narrow for the positive AND too weak for
52+
# the negative: a wrongly-pulled dependency whose objects happened to be cached
53+
# would print `Cached widget` and slip past a `Compiling`-only check.
54+
pulled() { grep -qE '(Compiling|Cached) widget' "$1"; }
55+
56+
# 1. Feature inactive → widget is NOT pulled (never resolved, never built).
5057
"$MCPP" build > b1.log 2>&1 || { cat b1.log; echo "FAIL: baseline build failed"; exit 1; }
51-
if grep -q 'Compiling widget' b1.log; then
58+
if pulled b1.log; then
5259
cat b1.log; echo "FAIL: widget must NOT be pulled when feature inactive"; exit 1
5360
fi
5461

55-
# 2. Feature active → widget IS pulled and compiled like a normal dependency.
62+
# 2. Feature active → widget IS pulled and built like a normal dependency.
5663
rm -rf target
5764
"$MCPP" build --features extra > b2.log 2>&1 || { cat b2.log; echo "FAIL: feature build failed (widget not pulled?)"; exit 1; }
58-
grep -q 'Compiling widget' b2.log || { cat b2.log; echo "FAIL: widget was not pulled/compiled when feature active"; exit 1; }
65+
pulled b2.log || { cat b2.log; echo "FAIL: widget was not pulled when feature active"; exit 1; }
5966

6067
echo "OK"

0 commit comments

Comments
 (0)