summaryrefslogtreecommitdiffstats
path: root/test/TEST-18-UEFI
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:35 +0000
commite6f2eaf47a177a8eca054d1d70a1b6287e8c3521 (patch)
treec5719e819a9e37df4b54affd61438f382ec38a8f /test/TEST-18-UEFI
parentAdding upstream version 060+5. (diff)
downloaddracut-upstream/102.tar.xz
dracut-upstream/102.zip
Adding upstream version 102.upstream/102
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/TEST-18-UEFI')
-rwxr-xr-xtest/TEST-18-UEFI/test-init.sh23
-rwxr-xr-xtest/TEST-18-UEFI/test.sh55
2 files changed, 15 insertions, 63 deletions
diff --git a/test/TEST-18-UEFI/test-init.sh b/test/TEST-18-UEFI/test-init.sh
deleted file mode 100755
index 03966d2..0000000
--- a/test/TEST-18-UEFI/test-init.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-export PATH=/usr/sbin:/usr/bin:/sbin:/bin
-
-[ -e /proc/self/mounts ] \
- || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc)
-
-grep -q '^sysfs /sys sysfs' /proc/self/mounts \
- || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys)
-
-grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \
- || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev)
-
-grep -q '^tmpfs /run tmpfs' /proc/self/mounts \
- || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run)
-
-: > /dev/watchdog
-
-exec > /dev/console 2>&1
-
-echo "made it to the rootfs! Powering down."
-echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/sdb
-poweroff -f
diff --git a/test/TEST-18-UEFI/test.sh b/test/TEST-18-UEFI/test.sh
index 4191fed..769a0e3 100755
--- a/test/TEST-18-UEFI/test.sh
+++ b/test/TEST-18-UEFI/test.sh
@@ -3,16 +3,10 @@
# shellcheck disable=SC2034
TEST_DESCRIPTION="UEFI boot"
-# Linux kernel requirements
-# CONFIG_BLK_DEV_INITRD for initramfs
-# CONFIG_EFI_HANDOVER_PROTOCOL for ovmf (Open Virtual Machine Firmware)
-# CONFIG_SATA_AHCI for ahci.ko
-# CONFIG_BLK_DEV_SD for sd_mod.ko
-# CONFIG_SQUASHFS_ZLIB for squashfs.ko
-
ovmf_code() {
for path in \
"/usr/share/OVMF/OVMF_CODE.fd" \
+ "/usr/share/OVMF/OVMF_CODE_4M.fd" \
"/usr/share/edk2/x64/OVMF_CODE.fd" \
"/usr/share/edk2-ovmf/OVMF_CODE.fd" \
"/usr/share/qemu/ovmf-x86_64-4m.bin"; do
@@ -24,33 +18,11 @@ test_check() {
[[ -n "$(ovmf_code)" ]]
}
-KVERSION="${KVERSION-$(uname -r)}"
-
-test_marker_reset() {
- dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
-}
-
-test_marker_check() {
- grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/marker.img
- return $?
-}
-
-test_dracut() {
- TEST_DRACUT_ARGS+=" --local --no-hostonly --no-early-microcode --add test --kver $KVERSION"
-
- # shellcheck disable=SC2162
- IFS=' ' read -a TEST_DRACUT_ARGS_ARRAY <<< "$TEST_DRACUT_ARGS"
-
- "$DRACUT" "$@" \
- --kernel-cmdline "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot selinux=0 console=ttyS0,115200n81 $DEBUGFAIL" \
- "${TEST_DRACUT_ARGS_ARRAY[@]}" || return 1
-}
-
test_run() {
declare -a disk_args=()
declare -i disk_index=1
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/squashfs.img root
+ qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker
+ qemu_add_drive disk_index disk_args "$TESTDIR"/squashfs.img root
test_marker_reset
"$testdir"/run-qemu "${disk_args[@]}" -net none \
@@ -62,8 +34,8 @@ test_run() {
test_setup() {
# Create what will eventually be our root filesystem
- "$DRACUT" --local --no-hostonly --no-early-microcode --nofscks \
- --tmpdir "$TESTDIR" --keep --modules "test-root" --include ./test-init.sh /sbin/init \
+ "$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
+ -m "test-root" \
"$TESTDIR"/tmp-initramfs.root "$KVERSION" || return 1
mkdir -p "$TESTDIR"/dracut.*/initramfs/proc
@@ -71,15 +43,18 @@ test_setup() {
mkdir -p "$TESTDIR"/ESP/EFI/BOOT
- if [ -f "/usr/lib/gummiboot/linuxx64.efi.stub" ]; then
- TEST_DRACUT_ARGS+=" --uefi-stub /usr/lib/gummiboot/linuxx64.efi.stub "
- fi
+ test_dracut \
+ --modules 'rootfs-block' \
+ --kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \
+ --drivers 'squashfs' \
+ --uefi \
+ "$TESTDIR"/ESP/EFI/BOOT/BOOTX64.efi
- mkdir -p "$TESTDIR"/ESP/EFI/BOOT
test_dracut \
- --modules 'rootfs-block test' \
- --kernel-cmdline 'root=/dev/sdc ro rd.skipfsck rootfstype=squashfs' \
- --drivers 'ahci sd_mod squashfs' \
+ --hostonly \
+ --modules 'rootfs-block' \
+ --kernel-cmdline 'root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root ro rd.skipfsck rootfstype=squashfs' \
+ --drivers 'squashfs' \
--uefi \
"$TESTDIR"/ESP/EFI/BOOT/BOOTX64.efi
}