qemu: payload-dir.sh uses if blocks (shellcheck SC2015)
ci / test (push) Successful in 19s
ci / mcdc (push) Successful in 14s
ci / bench (push) Successful in 13s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / patches-apply (push) Successful in 39s
ci / quality (push) Successful in 1m35s
ci / badges (push) Skipped
ci / qemu-tools (push) Successful in 2m47s
ci / kernel-symbols (push) Canceled after 4m16s
ci / test (push) Successful in 19s
ci / mcdc (push) Successful in 14s
ci / bench (push) Successful in 13s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / patches-apply (push) Successful in 39s
ci / quality (push) Successful in 1m35s
ci / badges (push) Skipped
ci / qemu-tools (push) Successful in 2m47s
ci / kernel-symbols (push) Canceled after 4m16s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9998182ef5
commit
06b86e68b4
+35
-21
@@ -84,23 +84,33 @@ if OUT="$OUT1" BUSYBOX="$BUSYBOX_BIN" PAYLOAD_DIR="$ALT" \
|
||||
IMG="$SCRATCH/$slot.1.img"
|
||||
extract_part "$OUT1/disk.img" "$slot" "$IMG"
|
||||
ui="$(debugfs -R "cat /usr/bin/warden-ui" "$IMG" 2>/dev/null)"
|
||||
[ "$ui" = "alt-ui" ] \
|
||||
&& pass "PAYLOAD_DIR: $slot carries the run's own warden-ui" \
|
||||
|| fail "PAYLOAD_DIR: $slot warden-ui = '$ui', want 'alt-ui'"
|
||||
if [ "$ui" = "alt-ui" ]; then
|
||||
pass "PAYLOAD_DIR: $slot carries the run's own warden-ui"
|
||||
else
|
||||
fail "PAYLOAD_DIR: $slot warden-ui = '$ui', want 'alt-ui'"
|
||||
fi
|
||||
tool="$(debugfs -R "cat /usr/bin/wthctl" "$IMG" 2>/dev/null)"
|
||||
[ "$tool" = "linked tool" ] \
|
||||
&& pass "PAYLOAD_DIR: $slot gets a symlinked entry's content" \
|
||||
|| fail "PAYLOAD_DIR: $slot wthctl = '$tool', want the symlink target's content"
|
||||
if [ "$tool" = "linked tool" ]; then
|
||||
pass "PAYLOAD_DIR: $slot gets a symlinked entry's content"
|
||||
else
|
||||
fail "PAYLOAD_DIR: $slot wthctl = '$tool', want the symlink target's content"
|
||||
fi
|
||||
mode="$(debugfs -R "stat /usr/bin/wthctl" "$IMG" 2>/dev/null | grep -oE 'Mode: *[0-7]+' | grep -oE '[0-7]+$')"
|
||||
[ "$mode" = "0755" ] \
|
||||
&& pass "PAYLOAD_DIR: $slot installs a regular 0755 file for the symlink" \
|
||||
|| fail "PAYLOAD_DIR: $slot wthctl mode '$mode', want 0755"
|
||||
debugfs -R "stat /usr/bin/warden-default-only" "$IMG" 2>&1 | grep -q 'File not found' \
|
||||
&& pass "PAYLOAD_DIR: $slot has nothing from qemu/payload" \
|
||||
|| fail "PAYLOAD_DIR: $slot carries qemu/payload's warden-default-only"
|
||||
debugfs -R "stat /usr/bin/README.md" "$IMG" 2>&1 | grep -q 'File not found' \
|
||||
&& pass "PAYLOAD_DIR: $slot skips the set's README.md" \
|
||||
|| fail "PAYLOAD_DIR: $slot carries the set's README.md"
|
||||
if [ "$mode" = "0755" ]; then
|
||||
pass "PAYLOAD_DIR: $slot installs a regular 0755 file for the symlink"
|
||||
else
|
||||
fail "PAYLOAD_DIR: $slot wthctl mode '$mode', want 0755"
|
||||
fi
|
||||
if debugfs -R "stat /usr/bin/warden-default-only" "$IMG" 2>&1 | grep -q 'File not found'; then
|
||||
pass "PAYLOAD_DIR: $slot has nothing from qemu/payload"
|
||||
else
|
||||
fail "PAYLOAD_DIR: $slot carries qemu/payload's warden-default-only"
|
||||
fi
|
||||
if debugfs -R "stat /usr/bin/README.md" "$IMG" 2>&1 | grep -q 'File not found'; then
|
||||
pass "PAYLOAD_DIR: $slot skips the set's README.md"
|
||||
else
|
||||
fail "PAYLOAD_DIR: $slot carries the set's README.md"
|
||||
fi
|
||||
done
|
||||
else
|
||||
fail "PAYLOAD_DIR: mkimage.sh exited nonzero with a valid payload dir (see $SCRATCH/mkimage1.log)"
|
||||
@@ -113,9 +123,11 @@ if OUT="$OUT2" BUSYBOX="$BUSYBOX_BIN" \
|
||||
IMG="$SCRATCH/rootfs_a.2.img"
|
||||
extract_part "$OUT2/disk.img" rootfs_a "$IMG"
|
||||
ui="$(debugfs -R "cat /usr/bin/warden-ui" "$IMG" 2>/dev/null)"
|
||||
[ "$ui" = "default-ui" ] \
|
||||
&& pass "no PAYLOAD_DIR: rootfs_a carries qemu/payload's warden-ui" \
|
||||
|| fail "no PAYLOAD_DIR: rootfs_a warden-ui = '$ui', want 'default-ui'"
|
||||
if [ "$ui" = "default-ui" ]; then
|
||||
pass "no PAYLOAD_DIR: rootfs_a carries qemu/payload's warden-ui"
|
||||
else
|
||||
fail "no PAYLOAD_DIR: rootfs_a warden-ui = '$ui', want 'default-ui'"
|
||||
fi
|
||||
else
|
||||
fail "no PAYLOAD_DIR: mkimage.sh exited nonzero (see $SCRATCH/mkimage2.log)"
|
||||
fi
|
||||
@@ -146,9 +158,11 @@ printf 'page Demo\n' > "$SCRATCH/drive.txt"
|
||||
: > "$SCRATCH/zImage"
|
||||
err4="$(PAYLOAD_DIR="$EMPTY" PATH="$SCRATCH/nobin" "$BASH_BIN" "$QEMU_DIR/tests/ui-drive.sh" \
|
||||
"$SCRATCH/zImage" "$SCRATCH/drive.txt" "$SCRATCH/drive-out" 2>&1)"
|
||||
printf '%s' "$err4" | grep -qF "FATAL: no warden-ui in $EMPTY" \
|
||||
&& pass "ui-drive.sh: a PAYLOAD_DIR without warden-ui is refused, naming the directory" \
|
||||
|| fail "ui-drive.sh: PAYLOAD_DIR without warden-ui gave '$err4'"
|
||||
if printf '%s' "$err4" | grep -qF "FATAL: no warden-ui in $EMPTY"; then
|
||||
pass "ui-drive.sh: a PAYLOAD_DIR without warden-ui is refused, naming the directory"
|
||||
else
|
||||
fail "ui-drive.sh: PAYLOAD_DIR without warden-ui gave '$err4'"
|
||||
fi
|
||||
chmod +x "$ALT/warden-ui"
|
||||
err5="$(PAYLOAD_DIR="$ALT" PATH="$SCRATCH/nobin" "$BASH_BIN" "$QEMU_DIR/tests/ui-drive.sh" \
|
||||
"$SCRATCH/zImage" "$SCRATCH/drive.txt" "$SCRATCH/drive-out" 2>&1)"
|
||||
|
||||
Reference in New Issue
Block a user