Make a skipped check visible in the verdict rather than in scrollback

Two suites could report a clean pass for work that did not run.

stun-faults skips Phase 2 when tc netem is unavailable, announcing it
several hundred lines above the result and then printing a bare
"stun-faults-test passed". The verdict line now carries the count and
names each skipped phase, and a run in which every phase was skipped
fails outright, since it tested nothing.

deb-install defines a skip() helper and a SKIP counter, prints "N
skipped" in its summary, and calls skip() from nowhere, so the number can
only ever be 0. Its exit tested FAIL alone, meaning a skip could not have
failed the run even once something did set the counter. Gate on SKIP too.
That changes no current outcome, which is the reason to do it now rather
than later: the machinery and the reported number already existed, so the
first skip path added would have printed "N skipped" beside a zero exit
and read as coverage.

Verified by driving the verdict logic at zero, one and three skips: clean
pass, pass with the skip named, and a non-zero exit when nothing ran.
This commit is contained in:
Johnathan Corgan
2026-07-23 13:44:29 +00:00
parent 2a6039995d
commit d3eaad543d
2 changed files with 35 additions and 2 deletions
+23 -1
View File
@@ -212,6 +212,11 @@ preflight_assert_stun_active() {
return 1
}
# Phases that did not run, with the reason. Surfaced in the final verdict:
# the suite reports a pass per phase-level assertion, so a phase that never
# ran otherwise leaves a clean "passed" standing for work not done.
SKIPPED_PHASES=()
run_test() {
echo "=== stun-faults-test: setup ==="
cleanup
@@ -293,6 +298,7 @@ run_test() {
sleep 10
else
echo " Phase 2 skipped (no tc netem available); proceeding to Phase 3"
SKIPPED_PHASES+=("2 (delay): tc netem unavailable")
fi
assert_process_alive || { dump_diagnostics; return 1; }
@@ -321,7 +327,23 @@ run_test() {
}
cleanup
echo "stun-faults-test passed"
if [ ${#SKIPPED_PHASES[@]} -eq 0 ]; then
echo "stun-faults-test passed (3/3 phases ran)"
return 0
fi
# A phase that did not run is not a phase that passed. Say so in the line
# a reader takes the verdict from, rather than leaving it in scrollback
# several hundred lines up where the skip was announced.
local ran=$(( 3 - ${#SKIPPED_PHASES[@]} ))
echo "stun-faults-test passed ($ran/3 phases ran, ${#SKIPPED_PHASES[@]} skipped)"
local phase
for phase in "${SKIPPED_PHASES[@]}"; do
echo " SKIPPED phase $phase"
done
if [ "$ran" -eq 0 ]; then
echo "stun-faults-test: every phase was skipped, so nothing was tested" >&2
return 1
fi
}
main() {