Files
bfe-core1106-sdk/qemu/tests/busybox-panel-help.sh
T
BFE EngineeringandClaude Opus 5.5 37037926df
ci / quality (push) Successful in 2m25s
ci / badges (push) Skipped
ci / mcdc (push) Successful in 29s
ci / prune-artifacts (push) Skipped
ci / test (push) Successful in 13s
ci / bench (push) Successful in 10s
ci / patches-apply (push) Successful in 24s
ci / kernel-build (push) Skipped
ci / mcdc (pull_request) Successful in 21s
ci / bench (pull_request) Successful in 17s
ci / test (pull_request) Successful in 14s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / qemu-tools (push) Successful in 4m32s
ci / kernel-symbols (push) Successful in 4m28s
ci / patches-apply (pull_request) Successful in 57s
ci / qemu-tools (pull_request) Successful in 3m8s
ci / kernel-symbols (pull_request) Successful in 6m42s
ci / quality (pull_request) Successful in 2m19s
ci / badges (pull_request) Skipped
qemu: build the panel's own BusyBox for the rig (flare-edge#2210)
The rig runs busybox.net's 1.31.0 multiarch binary, not the image's 1.37.0
with its applet config, so a script calling an applet or option the panel
lacks (#1903 setpriv --reuid, #2002 stat, #1349 flock -w) passes in the rig
and breaks on a panel.

- qemu/busybox/panel.config: the image's config, rebuilt from Buildroot
  2025.02.8 busybox.config plus 0001-busybox-applets.patch, resolved for
  1.37.0 as Buildroot does. patches/: Buildroot's 11 busybox patches.
  rig.fragment: static link and BusyBox's own passwd readers only.
  applets.txt and help.txt: the bench a capture (image 417a66b).
- qemu/build-busybox.sh: pinned 1.37.0 source, fails on any Kconfig rewrite
  of the config, an applet list other than the panel's, or a dynamic binary.
- qemu/lib.sh: RIG_BUSYBOX=panel selects it (default stays multiarch);
  the bounded verified download is now qemu_fetch_verified.
- warden.shell uses warden_console_shell: cttyhack where it exists, else
  setsid -c on the console tty (the panel's BusyBox has no cttyhack).
- CI: offline tests in qemu-tools, a build there checked against every
  applet's --help from the panel through qemu-user, and a second boot smoke
  with the panel initramfs in kernel-build.

Refs flare-edge#2210

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
2026-10-29 07:36:25 -06:00

40 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# Check a built panel BusyBox against the bench capture (flare-edge#2210):
# its applet list must equal qemu/busybox/applets.txt and every applet's
# --help text must equal qemu/busybox/help.txt, which lists the options each
# applet of the panel's own binary accepts. The binary is ARM: the host runs
# it through binfmt, or through $QEMU_USER (e.g. qemu-arm) when set.
#
# bash qemu/tests/busybox-panel-help.sh [BIN] (default qemu/out/busybox-armv7l-panel)
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BB_DIR="$HERE/../busybox"
BIN="${1:-$HERE/../out/busybox-armv7l-panel}"
[ -x "$BIN" ] || { echo "FATAL: no busybox binary at $BIN (run qemu/build-busybox.sh)" >&2; exit 1; }
export LC_ALL=C
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/bb-panel-help.XXXXXX")"
trap 'rm -rf "$SCRATCH"' EXIT
# Word splitting is wanted: QEMU_USER may carry arguments.
# shellcheck disable=SC2206
RUN=(${QEMU_USER:-} "$BIN")
"${RUN[@]}" --list | sort > "$SCRATCH/list.txt" || {
echo "FATAL: $BIN does not run here (no binfmt for ARM? set QEMU_USER=qemu-arm)" >&2
exit 1
}
if ! diff -u <(sort "$BB_DIR/applets.txt") "$SCRATCH/list.txt"; then
echo "FAIL: the applet list differs from qemu/busybox/applets.txt (- panel, + built)" >&2
exit 1
fi
# Same shape as flare-edge tools/bench/busybox-help/capture.sh: the banner
# line (version and build date) and blank lines dropped.
while IFS= read -r a; do
echo "== $a"
"${RUN[@]}" "$a" --help 2>&1 | sed 1d | sed '/^$/d' || true
done < "$SCRATCH/list.txt" > "$SCRATCH/help.txt"
if ! diff -u <(grep -v '^#' "$BB_DIR/help.txt") "$SCRATCH/help.txt"; then
echo "FAIL: --help differs from the panel's (qemu/busybox/help.txt; - panel, + built)" >&2
exit 1
fi
echo "busybox-panel-help: $(wc -l < "$SCRATCH/list.txt") applets, list and --help equal to the panel's"