Add test cases for different efi-firmware settings in VM config. Also enhance the PVE::QemuServer::OVMF test mock to trigger to handle nonexistent files. Signed-off-by: Christian Ludwig --- .../cfg2cmd/efi-custom-firmware-legacy.conf | 6 ++++ .../efi-custom-firmware-legacy.conf.cmd | 27 ++++++++++++++++ .../efi-custom-firmware-not-found.conf | 6 ++++ src/test/cfg2cmd/efi-custom-firmware-old.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-old.conf.cmd | 27 ++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-sev.conf | 7 +++++ .../cfg2cmd/efi-custom-firmware-sev.conf.cmd | 31 +++++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-snp.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-snp.conf.cmd | 29 +++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware-tdx.conf | 6 ++++ .../cfg2cmd/efi-custom-firmware-tdx.conf.cmd | 29 +++++++++++++++++ src/test/cfg2cmd/efi-custom-firmware.conf | 5 +++ src/test/cfg2cmd/efi-custom-firmware.conf.cmd | 30 ++++++++++++++++++ .../efi-firmware-bad-volid.conf.strict.error | 1 + .../efi-firmware-no-ovmf.conf.strict.error | 1 + .../efi-firmware-bad-volid.conf | 13 ++++++++ .../efi-firmware-no-ovmf.conf | 11 +++++++ src/test/parse-config-input/efi-firmware.conf | 13 ++++++++ .../regular-vm-efifirmware.conf | 17 ++++++++++ src/test/run_config2command_tests.pl | 2 ++ src/test/run_parse_config_tests.pl | 2 +- 21 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 src/test/cfg2cmd/efi-custom-firmware-legacy.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-not-found.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-old.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-sev.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-snp.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware-tdx.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd create mode 100644 src/test/cfg2cmd/efi-custom-firmware.conf create mode 100644 src/test/cfg2cmd/efi-custom-firmware.conf.cmd create mode 100644 src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error create mode 100644 src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error create mode 100644 src/test/parse-config-input/efi-firmware-bad-volid.conf create mode 100644 src/test/parse-config-input/efi-firmware-no-ovmf.conf create mode 100644 src/test/parse-config-input/efi-firmware.conf create mode 100644 src/test/parse-config-input/regular-vm-efifirmware.conf diff --git a/src/test/cfg2cmd/efi-custom-firmware-legacy.conf b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf new file mode 100644 index 00000000..27d2a59d --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces system OVMF_CODE path in legacy -drive command line +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +machine: pc-i440fx-4.1+pve0 +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd new file mode 100644 index 00000000..e7e870a5 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-legacy.conf.cmd @@ -0,0 +1,27 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/var/lib/vz/efi-firmware/custom.fd' \ + -drive 'if=pflash,unit=1,id=drive-efidisk0,format=raw,file=/var/lib/vz/images/100/vm-100-disk-0.raw' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -machine 'type=pc-i440fx-4.1+pve0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-not-found.conf b/src/test/cfg2cmd/efi-custom-firmware-not-found.conf new file mode 100644 index 00000000..fcc8774a --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-not-found.conf @@ -0,0 +1,6 @@ +# TEST: efi-firmware pointing to a nonexistent file causes die +# EXPECT_ERROR: efi-firmware volume 'local:efi-firmware/nonexistent.fd' not found at '/var/lib/vz/efi-firmware/nonexistent.fd' +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/nonexistent.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-old.conf b/src/test/cfg2cmd/efi-custom-firmware-old.conf new file mode 100644 index 00000000..5ac13d9c --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-old.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces system OVMF_CODE path in legacy -drive command line (old naming) +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +machine: pc-i440fx-4.1+pve0 +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd new file mode 100644 index 00000000..e7e870a5 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-old.conf.cmd @@ -0,0 +1,27 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -drive 'if=pflash,unit=0,format=raw,readonly=on,file=/var/lib/vz/efi-firmware/custom.fd' \ + -drive 'if=pflash,unit=1,id=drive-efidisk0,format=raw,file=/var/lib/vz/images/100/vm-100-disk-0.raw' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -machine 'type=pc-i440fx-4.1+pve0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-sev.conf b/src/test/cfg2cmd/efi-custom-firmware-sev.conf new file mode 100644 index 00000000..cb0d6a9e --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-sev.conf @@ -0,0 +1,7 @@ +# TEST: Custom efi-firmware replaces system OVMF_SEV_CODE path in SEV CVM blockdev command line +# HW_CAPABILITIES: amd-turin-9005 +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +efidisk0: local:100/vm-100-disk-0.raw,efitype=4m,pre-enrolled-keys=1,size=528K +amd-sev: type=std +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd new file mode 100644 index 00000000..4b3a67dc --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-sev.conf.cmd @@ -0,0 +1,31 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -object '{"id":"throttle-drive-efidisk0","limits":{},"qom-type":"throttle-group"}' \ + -blockdev '{"driver":"raw","file":{"driver":"file","filename":"/var/lib/vz/efi-firmware/custom.fd"},"node-name":"pflash0","read-only":true}' \ + -blockdev '{"detect-zeroes":"on","discard":"ignore","driver":"throttle","file":{"cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"raw","file":{"aio":"io_uring","cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"file","filename":"/var/lib/vz/images/100/vm-100-disk-0.raw","node-name":"e1175f2a490414e7c53337589fde17a","read-only":false},"node-name":"f1175f2a490414e7c53337589fde17a","read-only":false,"size":540672},"node-name":"drive-efidisk0","read-only":false,"throttle-group":"throttle-drive-efidisk0"}' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -object 'sev-guest,id=sev0,cbitpos=51,reduced-phys-bits=6,policy=0x8' \ + -machine 'pflash0=pflash0,pflash1=drive-efidisk0,type=pc+pve0,confidential-guest-support=sev0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-snp.conf b/src/test/cfg2cmd/efi-custom-firmware-snp.conf new file mode 100644 index 00000000..07a80a29 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-snp.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces default SNP firmware in -bios argument +# HW_CAPABILITIES: amd-turin-9005 +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +amd-sev: type=snp +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd new file mode 100644 index 00000000..678d1356 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-snp.conf.cmd @@ -0,0 +1,29 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -bios /var/lib/vz/efi-firmware/custom.fd \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -object 'sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=6,policy=0xb0000' \ + -machine 'type=pc+pve0,confidential-guest-support=sev0' diff --git a/src/test/cfg2cmd/efi-custom-firmware-tdx.conf b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf new file mode 100644 index 00000000..8219dad3 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf @@ -0,0 +1,6 @@ +# TEST: Custom efi-firmware replaces default TDX firmware in -bios argument +# HW_CAPABILITIES: {"intel-tdx":{"tdx-support":true},"amd-sev":{"cbitpos":0,"reduced-phys-bits":0,"sev-support":false,"sev-support-es":false,"sev-support-snp":false}} +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +intel-tdx: tdx,attestation=0 +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd new file mode 100644 index 00000000..7902aaef --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware-tdx.conf.cmd @@ -0,0 +1,29 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -bios /var/lib/vz/efi-firmware/custom.fd \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -object '{"id":"tdx0","qom-type":"tdx-guest"}' \ + -machine 'type=pc+pve0,confidential-guest-support=tdx0,kernel_irqchip=split' diff --git a/src/test/cfg2cmd/efi-custom-firmware.conf b/src/test/cfg2cmd/efi-custom-firmware.conf new file mode 100644 index 00000000..25ca7bc4 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware.conf @@ -0,0 +1,5 @@ +# TEST: Custom efi-firmware replaces system OVMF_CODE path in blockdev command line +smbios1: uuid=7b10d7af-b932-4c66-b2c3-3996152ec465 +bios: ovmf +efidisk0: local:100/vm-100-disk-0.raw +efi-firmware: local:efi-firmware/custom.fd diff --git a/src/test/cfg2cmd/efi-custom-firmware.conf.cmd b/src/test/cfg2cmd/efi-custom-firmware.conf.cmd new file mode 100644 index 00000000..526d99c3 --- /dev/null +++ b/src/test/cfg2cmd/efi-custom-firmware.conf.cmd @@ -0,0 +1,30 @@ +/usr/bin/kvm \ + -id 8006 \ + -name vm8006 \ + -no-shutdown \ + -chardev 'socket,id=qmp,path=/var/run/qemu-server/8006.qmp,server=on,wait=off' \ + -mon 'chardev=qmp,mode=control' \ + -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect-ms=5000' \ + -mon 'chardev=qmp-event,mode=control' \ + -pidfile /var/run/qemu-server/8006.pid \ + -daemonize \ + -smbios 'type=1,uuid=7b10d7af-b932-4c66-b2c3-3996152ec465' \ + -object '{"id":"throttle-drive-efidisk0","limits":{},"qom-type":"throttle-group"}' \ + -blockdev '{"driver":"raw","file":{"driver":"file","filename":"/var/lib/vz/efi-firmware/custom.fd"},"node-name":"pflash0","read-only":true}' \ + -blockdev '{"detect-zeroes":"on","discard":"ignore","driver":"throttle","file":{"cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"raw","file":{"aio":"io_uring","cache":{"direct":false,"no-flush":false},"detect-zeroes":"on","discard":"ignore","driver":"file","filename":"/var/lib/vz/images/100/vm-100-disk-0.raw","node-name":"e1175f2a490414e7c53337589fde17a","read-only":false},"node-name":"f1175f2a490414e7c53337589fde17a","read-only":false,"size":131072},"node-name":"drive-efidisk0","read-only":false,"throttle-group":"throttle-drive-efidisk0"}' \ + -smp '1,sockets=1,cores=1,maxcpus=1' \ + -nodefaults \ + -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' \ + -vnc 'unix:/var/run/qemu-server/8006.vnc,password=on' \ + -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep \ + -m 512 \ + -global 'PIIX4_PM.disable_s3=1' \ + -global 'PIIX4_PM.disable_s4=1' \ + -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' \ + -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' \ + -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' \ + -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' \ + -device 'VGA,id=vga,bus=pci.0,addr=0x2' \ + -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3,free-page-reporting=on' \ + -iscsi 'initiator-name=iqn.1993-08.org.debian:01:aabbccddeeff' \ + -machine 'pflash0=pflash0,pflash1=drive-efidisk0,type=pc+pve0' diff --git a/src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error b/src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error new file mode 100644 index 00000000..35672ff1 --- /dev/null +++ b/src/test/parse-config-expected/efi-firmware-bad-volid.conf.strict.error @@ -0,0 +1 @@ +vm 8006 - efi-firmware: invalid volid format, expected :efi-firmware/ diff --git a/src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error b/src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error new file mode 100644 index 00000000..3a56d271 --- /dev/null +++ b/src/test/parse-config-expected/efi-firmware-no-ovmf.conf.strict.error @@ -0,0 +1 @@ +vm 8006 - efi-firmware requires bios=ovmf diff --git a/src/test/parse-config-input/efi-firmware-bad-volid.conf b/src/test/parse-config-input/efi-firmware-bad-volid.conf new file mode 100644 index 00000000..c91afb69 --- /dev/null +++ b/src/test/parse-config-input/efi-firmware-bad-volid.conf @@ -0,0 +1,13 @@ +bios: ovmf +boot: order=scsi0 +cores: 2 +efi-firmware: local:iso/custom.fd +efidisk0: local-lvm:vm-100-disk-0,efitype=4m,pre-enrolled-keys=1 +memory: 1024 +name: test-vm +net0: virtio=BC:24:11:2C:69:EC,bridge=vmbr0 +numa: 0 +ostype: l26 +scsi0: local-lvm:vm-100-disk-1,size=8G +scsihw: virtio-scsi-pci +sockets: 1 diff --git a/src/test/parse-config-input/efi-firmware-no-ovmf.conf b/src/test/parse-config-input/efi-firmware-no-ovmf.conf new file mode 100644 index 00000000..3739d8f5 --- /dev/null +++ b/src/test/parse-config-input/efi-firmware-no-ovmf.conf @@ -0,0 +1,11 @@ +boot: order=scsi0 +cores: 2 +efi-firmware: local:efi-firmware/custom.fd +memory: 1024 +name: test-vm +net0: virtio=BC:24:11:2C:69:EC,bridge=vmbr0 +numa: 0 +ostype: l26 +scsi0: local-lvm:vm-100-disk-0,size=8G +scsihw: virtio-scsi-pci +sockets: 1 diff --git a/src/test/parse-config-input/efi-firmware.conf b/src/test/parse-config-input/efi-firmware.conf new file mode 100644 index 00000000..c39570d9 --- /dev/null +++ b/src/test/parse-config-input/efi-firmware.conf @@ -0,0 +1,13 @@ +bios: ovmf +boot: order=scsi0 +cores: 2 +efi-firmware: local:efi-firmware/custom.fd +efidisk0: local-lvm:vm-100-disk-0,efitype=4m,pre-enrolled-keys=1 +memory: 1024 +name: test-vm +net0: virtio=BC:24:11:2C:69:EC,bridge=vmbr0 +numa: 0 +ostype: l26 +scsi0: local-lvm:vm-100-disk-1,size=8G +scsihw: virtio-scsi-pci +sockets: 1 diff --git a/src/test/parse-config-input/regular-vm-efifirmware.conf b/src/test/parse-config-input/regular-vm-efifirmware.conf new file mode 100644 index 00000000..78a03e71 --- /dev/null +++ b/src/test/parse-config-input/regular-vm-efifirmware.conf @@ -0,0 +1,17 @@ +# regular VM with an EFI disk and custom firmware +bios: ovmf +boot: order=scsi0;ide2;net0 +cores: 1 +efi-firmware: mydir:efi-firmware/custom.fd +efidisk0: mydir:139/vm-139-disk-0.qcow2,size=128K +ide2: local:iso/debian-10.6.0-amd64-netinst.iso,media=cdrom +memory: 2048 +name: eficloneclone +net0: virtio=7A:6C:A5:8B:11:93,bridge=vmbr0,firewall=1 +numa: 0 +ostype: l26 +scsi0: rbdkvm:vm-139-disk-1,size=4G +scsihw: virtio-scsi-pci +smbios1: uuid=21a7e7bc-3cd2-4232-a009-a41f4ee992ae +sockets: 1 +vmgenid: 0 diff --git a/src/test/run_config2command_tests.pl b/src/test/run_config2command_tests.pl index 47250c67..a2e95add 100755 --- a/src/test/run_config2command_tests.pl +++ b/src/test/run_config2command_tests.pl @@ -31,6 +31,7 @@ my $base_env = { content => { images => 1, iso => 1, + 'efi-firmware' => 1, }, path => '/var/lib/vz', type => 'dir', @@ -285,6 +286,7 @@ my $qemu_server_ovmf_module = Test::MockModule->new("PVE::QemuServer::OVMF"); $qemu_server_ovmf_module->mock( file_exists => sub { my ($path) = @_; + return 0 if $path =~ m/nonexistent/; return 1; }, file_get_size => sub { diff --git a/src/test/run_parse_config_tests.pl b/src/test/run_parse_config_tests.pl index 62e36ee0..3e31bc30 100755 --- a/src/test/run_parse_config_tests.pl +++ b/src/test/run_parse_config_tests.pl @@ -26,7 +26,7 @@ my $OUTPUT_DIR = './parse-config-output'; my $EXPECTED_DIR = './parse-config-expected'; # NOTE update when you add/remove tests -plan tests => 2 * 10; +plan tests => 2 * 14; sub run_tests { my ($strict) = @_; -- 2.34.1