Skip to content

Commit bf55e15

Browse files
committed
install: add a "firmware" parameter
1 parent ca832ee commit bf55e15

File tree

1 file changed

+54
-42
lines changed

1 file changed

+54
-42
lines changed

tests/install/test.py

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,43 @@ class TestNested:
1313
@pytest.mark.parametrize("iso_version", (
1414
"821.1", "83b2",
1515
))
16-
@pytest.mark.vm_definitions(
17-
dict(name="vm1",
18-
template="Other install media",
19-
params=(
20-
# dict(param_name="", value=""),
21-
dict(param_name="memory-static-max", value="4GiB"),
22-
dict(param_name="memory-dynamic-max", value="4GiB"),
23-
dict(param_name="memory-dynamic-min", value="4GiB"),
24-
dict(param_name="platform", key="exp-nested-hvm", value="true"), # FIXME < 8.3 host?
25-
dict(param_name="HVM-boot-params", key="firmware", value="uefi"),
26-
dict(param_name="HVM-boot-params", key="order", value="dc"),
27-
dict(param_name="platform", key="device-model", value="qemu-upstream-uefi"),
28-
),
29-
vdis=[dict(name="vm1 system disk", size="100GiB", device="xvda", userdevice="0")],
30-
vifs=[dict(index=0, network_uuid="eabc1038-e40f-2ae5-0781-a3adbec1cae8")], # FIXME
31-
))
16+
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
17+
@pytest.mark.vm_definitions(lambda firmware: dict(
18+
name="vm1",
19+
template="Other install media",
20+
params=(
21+
# dict(param_name="", value=""),
22+
dict(param_name="memory-static-max", value="4GiB"),
23+
dict(param_name="memory-dynamic-max", value="4GiB"),
24+
dict(param_name="memory-dynamic-min", value="4GiB"),
25+
dict(param_name="platform", key="exp-nested-hvm", value="true"), # FIXME < 8.3 host?
26+
dict(param_name="HVM-boot-params", key="order", value="dc"),
27+
) + {
28+
"uefi": (
29+
dict(param_name="HVM-boot-params", key="firmware", value="uefi"),
30+
dict(param_name="platform", key="device-model", value="qemu-upstream-uefi"),
31+
),
32+
"bios": (),
33+
}[firmware],
34+
vdis=[dict(name="vm1 system disk", size="100GiB", device="xvda", userdevice="0")],
35+
vifs=[dict(index=0, network_uuid="eabc1038-e40f-2ae5-0781-a3adbec1cae8")], # FIXME
36+
),
37+
param_mapping={"firmware": "firmware"})
3238
@pytest.mark.installer_iso(
3339
lambda version: {
3440
"821.1": "xcpng-8.2.1-2023",
3541
"83b2": "xcpng-8.3-beta2",
3642
}[version],
3743
param_mapping={"version": "iso_version"})
38-
@pytest.mark.answerfile(
39-
{
40-
"base": "INSTALL",
41-
"source": {"type": "local"},
42-
"primary-disk": {"text": "nvme0n1"},
43-
})
44-
def test_install_uefi(self, request, iso_remaster, create_vms, iso_version):
44+
@pytest.mark.answerfile(lambda firmware: {
45+
"base": "INSTALL",
46+
"source": {"type": "local"},
47+
"primary-disk": {"text": {"uefi": "nvme0n1",
48+
"bios": "sda"}[firmware]
49+
},
50+
},
51+
param_mapping={"firmware": "firmware"})
52+
def test_install(self, request, firmware, iso_remaster, create_vms, iso_version):
4553
assert len(create_vms) == 1
4654
host_vm = create_vms[0]
4755
# FIXME should be part of vm def
@@ -125,16 +133,17 @@ def test_install_uefi(self, request, iso_remaster, create_vms, iso_version):
125133
"821.1",
126134
"821.1-821.1",
127135
))
128-
@pytest.mark.continuation_of(
129-
lambda params: [dict(vm="vm1",
130-
image_test=(f"TestNested::{{}}[{params}]".format(
131-
{
132-
1: "test_install_uefi",
133-
2: "test_upgrade_uefi",
134-
}[len(params.split("-"))]
135-
)))],
136-
param_mapping={"params": "mode"})
137-
def test_firstboot_uefi(self, request, create_vms, mode):
136+
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
137+
@pytest.mark.continuation_of(lambda params, firmware: [dict(
138+
vm="vm1",
139+
image_test=(f"TestNested::{{}}[{firmware}-{params}]".format(
140+
{
141+
1: "test_install",
142+
2: "test_upgrade",
143+
}[len(params.split("-"))]
144+
)))],
145+
param_mapping={"params": "mode", "firmware": "firmware"})
146+
def test_firstboot(self, firmware, request, create_vms, mode):
138147
host_vm = create_vms[0]
139148
vif = host_vm.vifs()[0]
140149
mac_address = vif.param_get('MAC')
@@ -237,23 +246,26 @@ def test_firstboot_uefi(self, request, create_vms, mode):
237246
("821.1", "83b2"),
238247
#("83b2", "83b2"), # 8.3b2 disabled the upgrade from 8.3
239248
])
240-
@pytest.mark.continuation_of(
241-
lambda params: [dict(vm="vm1",
242-
image_test=f"TestNested::test_firstboot_uefi[{params}]")],
243-
param_mapping={"params": "orig_version"})
249+
@pytest.mark.parametrize("firmware", ("uefi", "bios"))
250+
@pytest.mark.continuation_of(lambda firmware, params: [dict(
251+
vm="vm1",
252+
image_test=f"TestNested::test_firstboot[{firmware}-{params}]")],
253+
param_mapping={"params": "orig_version", "firmware": "firmware"})
244254
@pytest.mark.installer_iso(
245255
lambda version: {
246256
"821.1": "xcpng-8.2.1-2023",
247257
"83b2": "xcpng-8.3-beta2",
248258
}[version],
249259
param_mapping={"version": "iso_version"})
250-
@pytest.mark.answerfile(
251-
{
260+
@pytest.mark.answerfile(lambda firmware: {
252261
"base": "UPGRADE",
253262
"source": {"type": "local"},
254-
"existing-installation": {"text": "nvme0n1"},
255-
})
256-
def test_upgrade_uefi(self, iso_remaster, create_vms, orig_version, iso_version):
263+
"existing-installation": {"text": {"uefi": "nvme0n1",
264+
"bios": "sda"}[firmware]
265+
},
266+
},
267+
param_mapping={"firmware": "firmware"})
268+
def test_upgrade(self, firmware, iso_remaster, create_vms, orig_version, iso_version):
257269
host_vm = create_vms[0]
258270
vif = host_vm.vifs()[0]
259271
mac_address = vif.param_get('MAC')

0 commit comments

Comments
 (0)