Skip to content

Commit 2c3dc54

Browse files
committed
test(293): the new refusal branch must not exit early
The ecosystem job runs this file and checks that each test "ran to its conclusion" — an assertion that exists so an early exit cannot masquerade as a pass. My branch for the toolchain refusal did `exit 0`, which skipped half two entirely: four correct cross builds that this file also guards. CI caught it; a local run did not, because locally the exit code is all a caller sees. The branch now records that half one is settled and lets the script continue. The "names both systems" assertion is asked only of the OS-mismatch refusal — the toolchain refusal is a different sentence about a different decision, one that never resolved a target at all, and demanding both triples from it would be asserting on the wrong object.
1 parent aa6d8dc commit 2c3dc54

1 file changed

Lines changed: 25 additions & 14 deletions

File tree

tests/e2e/293_the_requested_target_and_the_resolved_one_name_one_os.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,22 @@ out="$(cd "$work/mismatch" && "$MCPP" build --target x86_64-windows-gnu 2>&1 ||
5555
# green-by-silence rather than red. The arrangement either reproduced (the
5656
# report names two systems) or it did not; only the second is a skip.
5757
reported="$(printf '%s\n' "$out" | grep -oP 'Target \K\S+ → \S+' | head -1)"
58+
half_one_done=0
5859
case "$out" in
5960
*"different operating systems"*)
6061
echo " ok it refuses rather than building for the wrong system" ;;
6162
*"is not supported: mcpp builds only with toolchains it manages"*)
62-
# The stronger refusal: the arrangement cannot be expressed any more, so
63-
# the Windows target never reaches a Linux compiler. Reported and accepted
64-
# as a pass, NOT as a skip — a skip here would stop the test from seeing a
65-
# revert, which is what the whole comment above is about.
63+
# The stronger refusal: the arrangement cannot be expressed any more, so a
64+
# Windows target never reaches a Linux compiler through this door.
65+
#
66+
# ⚠️ AND IT MUST NOT `exit 0` HERE. Half two is independent of half one and
67+
# asserts that correct cross builds still go through; leaving early skips
68+
# it, and the ecosystem job that runs this file checks that each test "ran
69+
# to its conclusion" precisely so an early exit cannot masquerade as a
70+
# pass. Caught by that job, not by a local run.
6671
echo " ok the system toolchain is refused outright, so the mismatch"
6772
echo " this test guards cannot be reached through it"
68-
exit 0 ;;
73+
half_one_done=1 ;;
6974
*)
7075
asked="${reported%%*}"
7176
resolved="${reported##* → }"
@@ -89,15 +94,21 @@ esac
8994

9095
# ⭐ AND THE MESSAGE NAMES BOTH. A refusal that does not say what it resolved
9196
# to leaves the reader with the same question the report used to answer.
92-
ok=1
93-
printf '%s\n' "$out" | grep -q "x86_64-windows-gnu" || ok=0
94-
printf '%s\n' "$out" | grep -q "linux" || ok=0
95-
if [ "$ok" = 1 ]; then
96-
echo " ok and it names the target asked for and the one resolved"
97-
else
98-
echo "FAIL: the refusal does not name both systems"
99-
printf '%s\n' "$out" | head -4 | sed 's/^/ /'
100-
exit 1
97+
#
98+
# Only asked of the OS-mismatch refusal. The toolchain refusal is a different
99+
# sentence about a different decision — it never resolved a target at all —
100+
# and demanding both triples from it would be asserting on the wrong object.
101+
if [ "$half_one_done" = 0 ]; then
102+
ok=1
103+
printf '%s\n' "$out" | grep -q "x86_64-windows-gnu" || ok=0
104+
printf '%s\n' "$out" | grep -q "linux" || ok=0
105+
if [ "$ok" = 1 ]; then
106+
echo " ok and it names the target asked for and the one resolved"
107+
else
108+
echo "FAIL: the refusal does not name both systems"
109+
printf '%s\n' "$out" | head -4 | sed 's/^/ /'
110+
exit 1
111+
fi
101112
fi
102113

103114
# ── Half two: every correct cross build still goes through ────────────────

0 commit comments

Comments
 (0)