mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
test: fix checking output / initrd content
shellcheck correctly complains:
```
In debian/tests/qemu-klibc line 13:
! lsinitramfs "${INITRAMFS}" | grep -qw busybox
^-- SC2251 (info): This ! is not on a condition and skips errexit. Use `&& exit 1` instead, or make sure $? is checked.
Did you mean:
lsinitramfs "${INITRAMFS}" | grep -qw busybox && exit 1
In debian/tests/qemu-panic-shell line 30:
! grep -qF "(initramfs) " "${OUTPUT}"
^-- SC2251 (info): This ! is not on a condition and skips errexit. Use `&& exit 1` instead, or make sure $? is checked.
Did you mean:
grep -qF "(initramfs) " "${OUTPUT}" && exit 1
For more information:
https://www.shellcheck.net/wiki/SC2251 -- This ! is not on a condition and ...
```
So the result oft those checks were just ignored. Fix that and add error
messages for the failure case. Otherwise there would be no output
explaining the exit code.
Note: The recommendation from https://www.shellcheck.net/wiki/SC2251
would cause qemu-panic-shell to always fail:
https://github.com/koalaman/shellcheck/issues/3121
This commit is contained in:
parent
84115f9118
commit
a83ddc24ff
2
debian/tests/qemu-klibc
vendored
2
debian/tests/qemu-klibc
vendored
@ -11,7 +11,7 @@ BUSYBOX=n
|
||||
FSTYPE=ext2
|
||||
EOF
|
||||
build_initramfs
|
||||
! lsinitramfs "${INITRAMFS}" | grep -qw busybox
|
||||
! lsinitramfs "${INITRAMFS}" | grep -qw busybox || { echo "Error: busybox found in ${INITRAMFS}!" >&2; exit 1; }
|
||||
|
||||
build_rootfs_ext2
|
||||
|
||||
|
||||
4
debian/tests/qemu-panic-shell
vendored
4
debian/tests/qemu-panic-shell
vendored
@ -28,9 +28,9 @@ grep -qF "(initramfs) " "${OUTPUT}"
|
||||
run_qemu_nocheck "panic=-1"
|
||||
check_no_network_configuration
|
||||
grep -qF "Rebooting automatically due to panic= boot argument" "${OUTPUT}"
|
||||
! grep -qF "(initramfs) " "${OUTPUT}"
|
||||
! grep -qF "(initramfs) " "${OUTPUT}" || { echo "Error: '(initramfs) ' found in output log!" >&2; exit 1; }
|
||||
|
||||
run_qemu_nocheck "panic=0"
|
||||
check_no_network_configuration
|
||||
grep -qF "Halting automatically due to panic= boot argument" "${OUTPUT}"
|
||||
! grep -qF "(initramfs) " "${OUTPUT}"
|
||||
! grep -qF "(initramfs) " "${OUTPUT}" || { echo "Error: '(initramfs) ' found in output log!" >&2; exit 1; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user