diff --git a/llembas/tests/smoke.sh b/llembas/tests/smoke.sh index a0593743b..63acc6247 100755 --- a/llembas/tests/smoke.sh +++ b/llembas/tests/smoke.sh @@ -29,7 +29,9 @@ chmod 700 "$work/run" clean() { env -i PATH=/usr/bin:/bin HOME="$work/home" XDG_RUNTIME_DIR="$work/run" XDG_CONFIG_HOME="$work/cfg" "$@"; } ok() { echo "ok $1"; } -bad() { echo "FAIL $1"; failed=1; } +# On GitHub a failure is also an annotation on the run: a line, with newlines made visible. +note() { [ -z "${GITHUB_ACTIONS:-}" ] || printf '::error title=smoke::%s\n' "$(printf '%s' "$1" | head -c 900 | tr '\n\r' ' ' | sed 's/%/%25/g')"; } +bad() { echo "FAIL $1"; note "$1"; failed=1; } expect() { # name, text, pattern if printf '%s' "$2" | grep -Eq -- "$3"; then ok "$1"; else bad "$1: wanted /$3/ in: $2"; fi } @@ -54,7 +56,7 @@ for _ in $(seq 40); do kill -0 "$pid" 2>/dev/null || break sleep 0.25 done -if [ -S "$sock" ]; then ok "the server listens in its own runtime directory ($APPDIR)"; else bad "no socket at $sock"; cat "$work/server.txt"; exit 1; fi +if [ -S "$sock" ]; then ok "the server listens in its own runtime directory ($APPDIR)"; else bad "no socket at $sock; the server said: $(tail -c 600 "$work/server.txt"); in the runtime directory: $(cd "$work/run" && find . | head -20 | tr '\n' ' ')"; cat "$work/server.txt"; exit 1; fi cli() { clean "$TTY" cli --no-auto-start "$@"; } # shellcheck disable=SC2016 # the pane's shell expands these, not this one