From b30621e372e00c1bb001bf4abaa398ff67d4fe63 Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 28 Sep 2026 01:28:24 -0600 Subject: [PATCH 1/3] Clear the shellcheck findings that would fail qemu-tools CI has not run on this repository since the move to Gitea (Actions was off), and 13 shellcheck findings accumulated in the files the qemu-tools job lints, so that job would fail the moment Actions is enabled. - test-ui-drive-rs485.sh: eight `cond && pass || fail` checks become if/then/else, so a pass() that returned non-zero could never also record a failure. - ui-drive.sh and mk-bootimg.sh: four `[ A ] && [ B ] || die` guards get explicit braces; the behaviour is unchanged. - fetch-vendor.sh: the unused fourth read field is `_desc`; it still has to be read so the loop's other fields are split correctly. Every qemu-tools step passes locally, including all four rs485 cases. Closes #2 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg --- build/fetch-vendor.sh | 2 +- build/mk-bootimg.sh | 6 +-- qemu/tests/test-ui-drive-rs485.sh | 64 +++++++++++++++++++------------ qemu/tests/ui-drive.sh | 2 +- 4 files changed, 45 insertions(+), 29 deletions(-) diff --git a/build/fetch-vendor.sh b/build/fetch-vendor.sh index 8eca88b..14e12be 100755 --- a/build/fetch-vendor.sh +++ b/build/fetch-vendor.sh @@ -66,7 +66,7 @@ tree_path() { } rc=0 -while IFS=$'\t' read -r name url commit desc; do +while IFS=$'\t' read -r name url commit _desc; do case "$name" in ''|\#*) continue ;; esac path="$(tree_path "$name")" diff --git a/build/mk-bootimg.sh b/build/mk-bootimg.sh index e7c08f2..27e6338 100755 --- a/build/mk-bootimg.sh +++ b/build/mk-bootimg.sh @@ -52,8 +52,8 @@ while [ $# -gt 0 ]; do esac done -[ -n "$KERNEL" ] && [ -f "$KERNEL" ] || { echo "FATAL: --kernel: no such file" >&2; exit 1; } -[ -n "$DTB" ] && [ -f "$DTB" ] || { echo "FATAL: --dtb: no such file" >&2; exit 1; } +{ [ -n "$KERNEL" ] && [ -f "$KERNEL" ]; } || { echo "FATAL: --kernel: no such file" >&2; exit 1; } +{ [ -n "$DTB" ] && [ -f "$DTB" ]; } || { echo "FATAL: --dtb: no such file" >&2; exit 1; } [ -n "$OUT" ] || { echo "FATAL: --out is required" >&2; exit 1; } command -v mkimage >/dev/null || { echo "FATAL: mkimage not on PATH (Debian/Ubuntu: u-boot-tools)" >&2; exit 1; } @@ -76,7 +76,7 @@ if [ -z "$RTOOL" ]; then [ -x "$c" ] && { RTOOL="$c"; break; } done fi -[ -n "$RTOOL" ] && [ -x "$RTOOL" ] || { +{ [ -n "$RTOOL" ] && [ -x "$RTOOL" ]; } || { echo "FATAL: resource_tool not found; pass --resource-tool PATH" >&2; exit 1; } WORKDIR="$(mktemp -d)" diff --git a/qemu/tests/test-ui-drive-rs485.sh b/qemu/tests/test-ui-drive-rs485.sh index a3d5adb..c759ccc 100755 --- a/qemu/tests/test-ui-drive-rs485.sh +++ b/qemu/tests/test-ui-drive-rs485.sh @@ -98,15 +98,21 @@ printf '#!/usr/bin/env python3\nimport sys; sys.exit(1)\n' > "$FLARE_EDGE/tools/ # without a subshell: run_rig's RIG_OUT/RIG_RC writes land here directly, so # nothing needs to be re-serialized as text and re-parsed back out below. FLARE_EDGE="$FLARE_EDGE" TEST_MAKE_RS_SOCK='' run_rig "$work" -[ "$RIG_RC" -ne 0 ] \ - && pass "case A: never-appeared rs.sock fails the run (rc=$RIG_RC)" \ - || fail "case A: never-appeared rs.sock fails the run: rc=$RIG_RC, out: $RIG_OUT" -printf '%s\n' "$RIG_OUT" | grep -qF 'FATAL: rs485 bus socket never appeared' \ - && pass "case A: FATAL names the missing rs.sock" \ - || fail "case A: FATAL names the missing rs.sock: $RIG_OUT" -printf '%s\n' "$RIG_OUT" | grep -qF '== rs485 simulator:' \ - && fail "case A: printed the rs485-live success line over a bus that was never up: $RIG_OUT" \ - || pass "case A: never claims the bus is live" +if [ "$RIG_RC" -ne 0 ]; then + pass "case A: never-appeared rs.sock fails the run (rc=$RIG_RC)" +else + fail "case A: never-appeared rs.sock fails the run: rc=$RIG_RC, out: $RIG_OUT" +fi +if printf '%s\n' "$RIG_OUT" | grep -qF 'FATAL: rs485 bus socket never appeared'; then + pass "case A: FATAL names the missing rs.sock" +else + fail "case A: FATAL names the missing rs.sock: $RIG_OUT" +fi +if printf '%s\n' "$RIG_OUT" | grep -qF '== rs485 simulator:'; then + fail "case A: printed the rs485-live success line over a bus that was never up: $RIG_OUT" +else + pass "case A: never claims the bus is live" +fi # --- case B: rs.sock is up but socat never creates rs.pty ------------------- work="$SCRATCH/b"; build_rig "$work" @@ -117,12 +123,16 @@ FAKEBIN="$SCRATCH/fakebin-b"; mkdir -p "$FAKEBIN" printf '#!/usr/bin/env bash\necho "FAKE SOCAT: simulated failure" >&2\nexit 1\n' > "$FAKEBIN/socat" chmod +x "$FAKEBIN/socat" FLARE_EDGE="$FLARE_EDGE" TEST_MAKE_RS_SOCK=1 PATH="$FAKEBIN:$PATH" run_rig "$work" -[ "$RIG_RC" -ne 0 ] \ - && pass "case B: socat never linking rs.pty fails the run (rc=$RIG_RC)" \ - || fail "case B: socat never linking rs.pty fails the run: rc=$RIG_RC, out: $RIG_OUT" -printf '%s\n' "$RIG_OUT" | grep -qF 'FATAL: rs485 socat never created rs.pty' \ - && pass "case B: FATAL names the missing rs.pty" \ - || fail "case B: FATAL names the missing rs.pty: $RIG_OUT" +if [ "$RIG_RC" -ne 0 ]; then + pass "case B: socat never linking rs.pty fails the run (rc=$RIG_RC)" +else + fail "case B: socat never linking rs.pty fails the run: rc=$RIG_RC, out: $RIG_OUT" +fi +if printf '%s\n' "$RIG_OUT" | grep -qF 'FATAL: rs485 socat never created rs.pty'; then + pass "case B: FATAL names the missing rs.pty" +else + fail "case B: FATAL names the missing rs.pty: $RIG_OUT" +fi # --- case C: rs.sock+rs.pty are up but mbsim.py crashes before rs.ctl ------- work="$SCRATCH/c"; build_rig "$work" @@ -135,15 +145,21 @@ sys.stderr.write("FAKE MBSIM: simulated crash before opening the control socket\ sys.exit(1) EOS FLARE_EDGE="$FLARE_EDGE" TEST_MAKE_RS_SOCK=1 TEST_MBSIM_PID_FILE='' run_rig "$work" -[ "$RIG_RC" -ne 0 ] \ - && pass "case C: mbsim.py crashing before rs.ctl fails the run (rc=$RIG_RC)" \ - || fail "case C: mbsim.py crashing before rs.ctl fails the run: rc=$RIG_RC, out: $RIG_OUT" -printf '%s\n' "$RIG_OUT" | grep -qF 'FATAL: rs485 simulator (mbsim.py) never came up' \ - && pass "case C: FATAL names the dead simulator" \ - || fail "case C: FATAL names the dead simulator: $RIG_OUT" -printf '%s\n' "$RIG_OUT" | grep -qF 'FAKE MBSIM: simulated crash' \ - && pass "case C: mbsim.log is dumped on failure" \ - || fail "case C: mbsim.log is dumped on failure: $RIG_OUT" +if [ "$RIG_RC" -ne 0 ]; then + pass "case C: mbsim.py crashing before rs.ctl fails the run (rc=$RIG_RC)" +else + fail "case C: mbsim.py crashing before rs.ctl fails the run: rc=$RIG_RC, out: $RIG_OUT" +fi +if printf '%s\n' "$RIG_OUT" | grep -qF 'FATAL: rs485 simulator (mbsim.py) never came up'; then + pass "case C: FATAL names the dead simulator" +else + fail "case C: FATAL names the dead simulator: $RIG_OUT" +fi +if printf '%s\n' "$RIG_OUT" | grep -qF 'FAKE MBSIM: simulated crash'; then + pass "case C: mbsim.log is dumped on failure" +else + fail "case C: mbsim.log is dumped on failure: $RIG_OUT" +fi # --- case D: a sim process that ignores SIGTERM is still reaped ------------ work="$SCRATCH/d"; build_rig "$work" diff --git a/qemu/tests/ui-drive.sh b/qemu/tests/ui-drive.sh index 1866756..5e042c6 100755 --- a/qemu/tests/ui-drive.sh +++ b/qemu/tests/ui-drive.sh @@ -195,7 +195,7 @@ if [ -n "$RS485_DEVICES" ]; then # simulator the serial device it expects; mbsim then answers the guest's # Modbus polls with the corpus profiles' own register maps. command -v socat >/dev/null || { echo "FATAL: --rs485-devices needs socat" >&2; exit 1; } - [ -n "${FLARE_EDGE:-}" ] && [ -f "$FLARE_EDGE/tools/modbus-sim/mbsim.py" ] || { + { [ -n "${FLARE_EDGE:-}" ] && [ -f "$FLARE_EDGE/tools/modbus-sim/mbsim.py" ]; } || { echo "FATAL: --rs485-devices needs FLARE_EDGE to point at a flare-edge checkout (mbsim.py)" >&2; exit 1; } wait_for_path "$WORK/rs.sock" [ -S "$WORK/rs.sock" ] || { -- 2.54.0 From fe29ece741d01ac31e3025c55d393e997a1b517b Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 28 Sep 2026 02:09:30 -0600 Subject: [PATCH 2/3] ci: let the quality job's pip install run on the Gitea runners The first CI run on Gitea (1447) failed only in quality: the job image's Python is PEP 668 externally managed, so 'pip install lizard ruff' is refused. GitHub's hosted runners set PIP_BREAK_SYSTEM_PACKAGES; set the same for that step, which runs in a throwaway container on a throwaway VM. Refs #2 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e775d50..eac1818 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -340,6 +340,12 @@ jobs: steps: - uses: actions/checkout@v4 - name: install analyzers + # The job image's Python is PEP 668 "externally managed", so a plain + # pip install is refused. GitHub's hosted runners set this same + # variable; here every job runs in a throwaway container on a + # throwaway VM (the GARM runners), so nothing outlives the job. + env: + PIP_BREAK_SYSTEM_PACKAGES: "1" run: | sudo apt-get update -qq && sudo apt-get install -y -qq cppcheck shellcheck pip install --quiet lizard ruff -- 2.54.0 From 4636f0fe4c1472d942c0d75231c96ffbece0b21f Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 28 Sep 2026 02:42:47 -0600 Subject: [PATCH 3/3] ci: keep PATH when the quality job runs npm under sudo sudo resets PATH to its secure_path, and the Gitea job image keeps node and npm in the runner tool cache, so 'sudo npm' was not found. Pass the job's PATH through; GitHub-hosted runners behave the same either way. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eac1818..c68e5f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -349,7 +349,7 @@ jobs: run: | sudo apt-get update -qq && sudo apt-get install -y -qq cppcheck shellcheck pip install --quiet lizard ruff - sudo npm install --silent -g jscpd + sudo env "PATH=$PATH" npm install --silent -g jscpd curl -fsSL -o /tmp/scc.tar.gz \ https://github.com/boyter/scc/releases/download/v3.6.0/scc_Linux_x86_64.tar.gz sudo tar -C /usr/local/bin -xzf /tmp/scc.tar.gz scc -- 2.54.0