test: smoke scripts fail when they stop before their last check

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 18:44:10 +02:00
co-authored by Claude Opus 5.5
parent 3a5f658f35
commit 314b3d0756
6 changed files with 24 additions and 10 deletions
+14
View File
@@ -20,6 +20,20 @@ INIT_RESPONSE=""
REQUEST_ID=100
fail() { echo "FAIL: $*"; exit 1; }
# A smoke script must reach its last line: finish() marks that and prints the verdict.
# guard_exit (called first in every EXIT trap) turns any other exit – including a silent
# stop that still returns 0 – into a failure, so a run can never pass without all checks.
SMOKE_FINISHED=0
finish() { SMOKE_FINISHED=1; echo "ALL CHECKS PASSED"; }
guard_exit() {
local rc=$1
if [ "$rc" -eq 0 ] && [ "$SMOKE_FINISHED" != 1 ]; then
echo "FAIL: script stopped before its last check (exit 0 without finish)"
return 1
fi
return "$rc"
}
pass() { echo "ok - $*"; }
# Removes every "lit-mcp-integration-test" application password of a user.