Skip to content

Commit

Permalink
pillar/tests: Adapt tests for ARM and FML OVMF firmware.
Browse files Browse the repository at this point in the history
Adapt the existing tests to account for the addition of the OVMF
settings file for FML guests, ensuring the expected output includes both
the BootLoader and BootLoaderSettingsFile. It also fixes the ARM tests
by ensuring the firmware line is present in the expected configuration,
aligning the tests with the updated behavior for UEFI boot on both AMD64
and ARM architectures.

Signed-off-by: Nikolay Martyanov <nikolay@zededa.com>
  • Loading branch information
OhmSpectator committed Sep 17, 2024
1 parent 8b7597d commit afd5710
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions pkg/pillar/hypervisor/kvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
[global]
driver = "kvm-pit"
property = "lost_tick_policy"
Expand Down Expand Up @@ -364,6 +363,8 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
})

config.VirtualizationMode = types.FML
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
config.BootLoaderSettingsFile = "/persist/ovmf/0000000000000000.0.0_OVMF_VARS.fd"
t.Run("amd64-fml", func(t *testing.T) {
conf.Seek(0, 0)
if err := kvmIntel.CreateDomConfig("test", config, types.DomainStatus{},
Expand Down Expand Up @@ -392,7 +393,6 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
[global]
driver = "kvm-pit"
property = "lost_tick_policy"
Expand All @@ -416,6 +416,19 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
driver = "intel-iommu"
caching-mode = "on"
[drive "drive-ovmf-code"]
if = "pflash"
format = "raw"
readonly = "on"
unit = "0"
file = "/usr/lib/xen/boot/ovmf.bin"
[drive "drive-ovmf-vars"]
if = "pflash"
format = "raw"
unit = "1"
file = "/persist/ovmf/0000000000000000.0.0_OVMF_VARS.fd"
[realtime]
mlock = "off"
Expand Down Expand Up @@ -636,6 +649,7 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
})

config.VirtualizationMode = types.HVM
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
t.Run("arm64", func(t *testing.T) {
conf.Seek(0, 0)
if err := kvmArm.CreateDomConfig("test", config, types.DomainStatus{},
Expand All @@ -659,6 +673,7 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
dump-guest-core = "off"
accel = "kvm:tcg"
gic-version = "host"
firmware = "/usr/lib/xen/boot/ovmf.bin"
kernel = "/boot/kernel"
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
Expand Down Expand Up @@ -952,6 +967,8 @@ func TestCreateDomConfigAmd64Fml(t *testing.T) {
diskConfigs, diskStatuses := qemuDisks()
config, aa := domainConfigAndAssignableAdapters(diskConfigs)
config.VirtualizationMode = types.FML
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
config.BootLoaderSettingsFile = "/persist/ovmf/0000000000000000.0.0_OVMF_VARS.fd"
addNonExistingAdapter(&config, &aa)
if err := kvmIntel.CreateDomConfig("test", config, types.DomainStatus{},
diskStatuses, &aa, nil, swtpmCtrlSock, conf); err != nil {
Expand Down Expand Up @@ -984,6 +1001,7 @@ func TestCreateDomConfigArm64(t *testing.T) {
diskConfigs, diskStatuses := qemuDisks()
config, aa := domainConfigAndAssignableAdapters(diskConfigs)
config.VirtualizationMode = types.HVM
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
if err := kvmArm.CreateDomConfig("test", config, types.DomainStatus{},
diskStatuses, &aa, nil, swtpmCtrlSock, conf); err != nil {
t.Errorf("CreateDomConfig failed %v", err)
Expand Down Expand Up @@ -1128,6 +1146,7 @@ func domConfigArm64() string {
dump-guest-core = "off"
accel = "kvm:tcg"
gic-version = "host"
firmware = "/usr/lib/xen/boot/ovmf.bin"
kernel = "/boot/kernel"
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
Expand Down Expand Up @@ -1396,7 +1415,6 @@ func domConfigAmd64FML() string {
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
[global]
driver = "kvm-pit"
property = "lost_tick_policy"
Expand All @@ -1420,6 +1438,19 @@ func domConfigAmd64FML() string {
driver = "intel-iommu"
caching-mode = "on"
[drive "drive-ovmf-code"]
if = "pflash"
format = "raw"
readonly = "on"
unit = "0"
file = "/usr/lib/xen/boot/ovmf.bin"
[drive "drive-ovmf-vars"]
if = "pflash"
format = "raw"
unit = "1"
file = "/persist/ovmf/0000000000000000.0.0_OVMF_VARS.fd"
[realtime]
mlock = "off"
Expand Down Expand Up @@ -1694,7 +1725,6 @@ func domConfigAmd64Legacy() string {
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
[global]
driver = "kvm-pit"
property = "lost_tick_policy"
Expand Down Expand Up @@ -1983,7 +2013,6 @@ func domConfigAmd64() string {
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
[global]
driver = "kvm-pit"
property = "lost_tick_policy"
Expand Down Expand Up @@ -2268,7 +2297,6 @@ func domConfigContainerVNC() string {
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
[global]
driver = "kvm-pit"
property = "lost_tick_policy"
Expand Down

0 comments on commit afd5710

Please sign in to comment.