ec0502f829
7d04aef replaced the byte-exact USAGE pin with a shape check that requires
every long flag grepped from the healthcheck source to appear in --help.
--json was already undocumented before this task, so that check was red on
arrival and it also dropped the 'unknown flag ignored' assertion on --bogus,
the only pin on the no---strict silent-ignore path.
The accepted plan's phase 3 is 'no edit': --help is untouched by --strict, so
master's version passes as-is.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
29 lines
996 B
Bash
Executable File
29 lines
996 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Self-check for orchestra_e2e_healthcheck.sh.
|
|
|
|
HC="$(dirname "$0")/orchestra_e2e_healthcheck.sh"
|
|
OK='OK - all healthchecks passed'
|
|
USAGE="$(printf 'Usage: orchestra_e2e_healthcheck.sh [--quiet]\n\nHealthcheck script for Orchestra E2E tests.\nExits 0 with a success message if all checks pass.\n --quiet Suppress the success message; still exits 0.')"
|
|
fails=0
|
|
|
|
check() { # check <expected-stdout> <label> [args...]
|
|
local want=$1 label=$2 got status
|
|
shift 2
|
|
got=$(bash "$HC" "$@" 2>/dev/null)
|
|
status=$?
|
|
if [ "$got" != "$want" ] || [ "$status" -ne 0 ]; then
|
|
printf 'FAIL: %s (exit=%s)\n---got---\n%s\n---want---\n%s\n' "$label" "$status" "$got" "$want"
|
|
fails=$((fails + 1))
|
|
fi
|
|
}
|
|
|
|
check "$OK" 'no args'
|
|
check '' '--quiet' --quiet
|
|
check "$USAGE" '--help' --help
|
|
check "$USAGE" '--help --quiet' --help --quiet
|
|
check "$USAGE" '--quiet --help' --quiet --help
|
|
check "$OK" 'unknown flag ignored' --bogus
|
|
|
|
[ "$fails" -eq 0 ] || exit 1
|
|
printf 'all checks passed\n'
|