test: Check that the network is not configured

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
This commit is contained in:
Benjamin Drung 2023-06-07 11:03:03 +02:00
parent febab1cc76
commit f9dbdc628f
7 changed files with 20 additions and 0 deletions

View File

@ -21,3 +21,4 @@ build_initramfs
build_rootfs_ext2
run_qemu
check_no_network_configuration

View File

@ -15,6 +15,7 @@ lsinitramfs "${INITRAMFS}" | grep -qw busybox
build_rootfs_ext2
run_qemu
check_no_network_configuration
# Check that fsck ran
grep -q "^/dev/${ROOTDISK_LINUX_NAME}: clean," "${OUTPUT}"

View File

@ -15,6 +15,7 @@ build_initramfs
build_rootfs_ext2
run_qemu
check_no_network_configuration
# Check that fsck ran
grep -q "^/dev/${ROOTDISK_LINUX_NAME}: clean," "${OUTPUT}"

View File

@ -20,13 +20,16 @@ build_initramfs
build_rootfs_ext2
run_qemu_nocheck
check_no_network_configuration
grep -qF "ALERT! /dev/nonexistent does not exist. Dropping to a shell!" "${OUTPUT}"
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}"
run_qemu_nocheck "panic=0"
check_no_network_configuration
grep -qF "Halting automatically due to panic= boot argument" "${OUTPUT}"
! grep -qF "(initramfs) " "${OUTPUT}"

View File

@ -30,6 +30,7 @@ build_rootfs_ext2
build_fs_ext2 "${USRDIR}" "${USRDISK}"
run_qemu
check_no_network_configuration
# Check that fsck ran on both devices
grep -q "^/dev/${ROOTDISK_LINUX_NAME}: clean," "${OUTPUT}"

View File

@ -20,3 +20,4 @@ build_initramfs
build_rootfs_ext2
run_qemu
check_no_network_configuration

View File

@ -162,3 +162,15 @@ run_qemu() {
_run_qemu "panic=-1"
grep -qF "${INIT_MESSAGE}" "${OUTPUT}"
}
check_no_output() {
local msg="$1"
if grep -qF "${msg}" "${OUTPUT}"; then
echo >&2 "E: Message '${msg}' found in log output '${OUTPUT}."
exit 1
fi
}
check_no_network_configuration() {
check_no_output "Waiting up to 180 secs for"
}