Files
NoahandClaude Fable 5.1 2b6e8a2098 qemu and build: review fixes across the rig driver, boot script, and fetch helpers
Bounded waits and validated arguments in run.sh and ui-drive.sh, a seeded
settings directory and root-only staged rootfs permissions with their own
tests, qmp.py and imgtools.py hardening, the fetch scripts checking what they
download, and ASCII typography throughout. Each fix carries its test under
qemu/tests or tests/.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N3G6m9Aw5RyVY4ZowtKzEj
2026-09-09 19:17:54 -06:00

46 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Regression test: --help must not spill into build/mk-bootimg.sh's own code.
#
# build/fetch-vendor.sh's --help sliced its own source with a hardcoded line
# range that stopped one line too late, printing "set -uo pipefail" -- the
# first line of code -- as the last line of help text. mk-bootimg.sh's
# --help used the same hardcoded-range shape (currently pointed at the right
# span), so the same slip was one header-comment edit away here too. It now
# uses the same self-terminating awk pattern fetch-vendor.sh was fixed to
# use, so this pins both that it stays in sync as the header grows or
# shrinks and that it matches the header verbatim today.
set -uo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
SCRIPT="$HERE/../../build/mk-bootimg.sh"
[ -f "$SCRIPT" ] || { echo "FAIL: script not found at $SCRIPT"; exit 1; }
fail=0
HELP_OUT="$(bash "$SCRIPT" --help)"
if printf '%s\n' "$HELP_OUT" | grep -q 'set -euo pipefail'; then
echo "FAIL: --help prints the script's own code"
fail=1
else
echo "PASS: --help does not print the script's own code"
fi
LAST_LINE="$(printf '%s\n' "$HELP_OUT" | tail -1)"
if [ "$LAST_LINE" = "# [--resource-tool PATH]" ]; then
echo "PASS: --help ends on the last header comment line, not past it"
else
echo "FAIL: --help ends on the last header comment line, not past it (got: $LAST_LINE)"
fail=1
fi
FIRST_LINE="$(printf '%s\n' "$HELP_OUT" | head -1)"
if [ "$FIRST_LINE" = "# Package a bootable boot.img from a kernel this SDK built." ]; then
echo "PASS: --help starts after the shebang, not on it"
else
echo "FAIL: --help starts after the shebang, not on it (got: $FIRST_LINE)"
fail=1
fi
exit "$fail"