Skip to content

Commit 0b265c2

Browse files
committed
test(e2e): 188's no-consumer case needs a target that does not exist, not a library
A `kind = "lib"` target used to serve as "nothing that takes an object action's outputs", because a static library did not take them. It does now, so that fixture stopped exercising the case and the suite reported it — which is the whole value of running it. The one shape that still leaves an object action with nowhere to go is a target behind an inactive `required_features`: it is absent from the build entirely. A control runs the same project with the feature on and asserts the diagnostic is gone, so the assertion cannot pass on a build that stopped emitting it for everyone.
1 parent 6d4d498 commit 0b265c2

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

tests/e2e/188_build_actions.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,24 +413,44 @@ grep -q '1 passed' o6.log || { cat o6.log; echo "FAIL: the test did not run"; ex
413413
# supposed to be reachable through a link edge), so "no consumer" means the
414414
# command never runs. Saying nothing there is the same failure `[resources]`
415415
# reports as resources/no-image.
416+
#
417+
# ⚠️ THE ONLY TARGET IS GATED OFF, and that is what makes this case exist at
418+
# all. A `kind = "lib"` target used to serve here, because a static library did
419+
# not take an object action's outputs; it does now (design C-6, e2e 608), so a
420+
# project with one is no longer a project with no consumer. A target behind an
421+
# inactive `required_features` is absent from the build entirely, which is the
422+
# one shape that leaves an object action with nowhere to go.
416423
mkdir -p "$TMP/objnone/src"
417424
cd "$TMP/objnone"
418425
cat > mcpp.toml <<'EOF'
419426
[package]
420427
name = "objnone"
421428
version = "0.1.0"
422429
430+
[features]
431+
gated = {}
432+
423433
[targets.objnone]
424434
kind = "lib"
435+
required_features = ["gated"]
425436
EOF
426437
printf 'export module objnone;\nexport int f(){return 1;}\n' > src/objnone.cppm
427438
cp "$TMP/objtest/blob.cpp" blob.cpp
428439
cp "$TMP/objtest/mkobj.sh" mkobj.sh
429440
cp "$TMP/objtest/build.mcpp" build.mcpp
430441
"$MCPP" build > o7.log 2>&1 || { cat o7.log; echo "FAIL: objnone build failed"; exit 1; }
431-
grep -q 'no executable, shared library or test binary' o7.log || {
442+
grep -q 'produces no target to put its outputs into' o7.log || {
432443
cat o7.log; echo "FAIL: an object with no consumer must be reported"; exit 1; }
433444

445+
# ⭐ THE CONTROL: with the feature on, the target exists and the action is not
446+
# reported. Without it the assertion above would pass on a build that had
447+
# stopped emitting the diagnostic for every project.
448+
"$MCPP" build --features gated > o7b.log 2>&1 || {
449+
cat o7b.log; echo "FAIL: objnone build with the feature failed"; exit 1; }
450+
grep -q 'produces no target to put its outputs into' o7b.log && {
451+
cat o7b.log; echo "FAIL: the object was reported as having no consumer while its target existed"
452+
exit 1; }
453+
434454
cd "$TMP/edge"
435455

436456
# ── 4. a malformed action is refused, not skipped ──────────────────────────

0 commit comments

Comments
 (0)