blob: 769a0e3b1d3eb230d762b2ee4553a1dc58d5f14d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/bash
# shellcheck disable=SC2034
TEST_DESCRIPTION="UEFI boot"
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
[[ -s $path ]] && echo -n "$path" && return
done
}
test_check() {
[[ -n "$(ovmf_code)" ]]
}
test_run() {
declare -a disk_args=()
declare -i disk_index=1
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 \
-drive file=fat:rw:"$TESTDIR"/ESP,format=vvfat,label=EFI \
-global driver=cfi.pflash01,property=secure,value=on \
-drive if=pflash,format=raw,unit=0,file="$(ovmf_code)",readonly=on
test_marker_check || return 1
}
test_setup() {
# Create what will eventually be our root filesystem
"$DRACUT" -N -l --keep --tmpdir "$TESTDIR" \
-m "test-root" \
"$TESTDIR"/tmp-initramfs.root "$KVERSION" || return 1
mkdir -p "$TESTDIR"/dracut.*/initramfs/proc
mksquashfs "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/squashfs.img -quiet -no-progress
mkdir -p "$TESTDIR"/ESP/EFI/BOOT
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
test_dracut \
--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
}
test_cleanup() {
return 0
}
# shellcheck disable=SC1090
. "$testdir"/test-functions
|