Skip to content

Commit 103eb9e

Browse files
committed
test(e2e 328): 层谓词不能选依赖 —— 补上这条的判据
实现了这条诊断,却从没跑过它 —— 而「判据写了、绿了、却从没跑到」正是本次发布在修的 那一族。带一条同样重要的对照:同一个谓词下的 build 输入必须**仍然生效**,否则一条 警告就是把一次静默丢弃换成了另一次。
1 parent 71cdcc0 commit 103eb9e

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

tests/e2e/328_layer_predicates_apply_and_unknown_ones_say_so.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,39 @@ set -e
181181
[ "$rc" -ne 0 ] || { cat unknown/s.log; echo "FAIL: --strict did not turn the warning into an error"; exit 1; }
182182
echo " ok --strict makes it an error"
183183

184+
# ── (4) a layer predicate cannot select dependencies, and says so ───────────
185+
#
186+
# A layer is resolved FROM the dependency graph, so a dependency chosen by one
187+
# would decide the answer it is asking for — docs/14 states the limit. The limit
188+
# is not the interesting part; being told about it is. By the time the layer
189+
# pass runs, dependency resolution is over, so such a section would otherwise be
190+
# dropped in exactly the silence this whole test exists to end.
191+
#
192+
# ⚠️ AND THE BUILD INPUTS UNDER THE SAME PREDICATE MUST STILL APPLY. A warning
193+
# that quietly disabled the rest of the section would trade one silent drop for
194+
# another.
195+
mkdir -p depcond/src
196+
cat > depcond/mcpp.toml <<EOF
197+
[package]
198+
name = "depcond"
199+
version = "0.1.0"
200+
201+
[target.'cfg(c-abi = "$NOTCABI")'.dependencies]
202+
never-resolved = "1.0.0"
203+
204+
[target.'cfg(c-abi = "$CABI")'.build]
205+
defines = ["INPUTS_STILL_APPLY=1"]
206+
EOF
207+
cat > depcond/src/main.cpp <<'EOF'
208+
#ifndef INPUTS_STILL_APPLY
209+
#error "the warning about dependencies also suppressed the build inputs"
210+
#endif
211+
int main() { return 0; }
212+
EOF
213+
( cd depcond && "$MCPP" build > d.log 2>&1 ) || {
214+
cat depcond/d.log; echo "FAIL: a layer-conditioned dependency must warn, not fail"; exit 1; }
215+
grep -q "conditions dependencies on a target-side layer" depcond/d.log || {
216+
cat depcond/d.log; echo "FAIL: no diagnostic for a layer-conditioned dependency"; exit 1; }
217+
echo " ok a layer-conditioned dependency is reported, and the build inputs still apply"
218+
184219
echo "PASS: 328 layer predicates apply, and unknown ones say so"

0 commit comments

Comments
 (0)