Skip to content

Commit c6d96dc

Browse files
committed
feat(virtio-pmem): add boottime tests
Parametrize the boottime tests to also test boottime from virtio-pmem device. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 1add065 commit c6d96dc

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

tests/integration_tests/performance/test_boottime.py

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,37 @@ def to_ms(v, unit):
9595

9696

9797
def launch_vm_with_boot_timer(
98-
microvm_factory, guest_kernel_acpi, rootfs_rw, vcpu_count, mem_size_mib, pci_enabled
98+
microvm_factory,
99+
guest_kernel_acpi,
100+
rootfs_rw,
101+
vcpu_count,
102+
mem_size_mib,
103+
pci_enabled,
104+
boot_from_pmem,
99105
):
100106
"""Launches a microVM with guest-timer and returns the reported metrics for it"""
101-
vm = microvm_factory.build(guest_kernel_acpi, rootfs_rw, pci=pci_enabled)
107+
vm = microvm_factory.build(
108+
guest_kernel_acpi, rootfs_rw, pci=pci_enabled, monitor_memory=False
109+
)
102110
vm.jailer.extra_args.update({"boot-timer": None})
103111
vm.spawn()
104-
vm.basic_config(
105-
vcpu_count=vcpu_count,
106-
mem_size_mib=mem_size_mib,
107-
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
108-
enable_entropy_device=True,
109-
)
112+
if not boot_from_pmem:
113+
vm.basic_config(
114+
vcpu_count=vcpu_count,
115+
mem_size_mib=mem_size_mib,
116+
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init",
117+
enable_entropy_device=True,
118+
)
119+
else:
120+
vm.basic_config(
121+
add_root_device=False,
122+
vcpu_count=vcpu_count,
123+
mem_size_mib=mem_size_mib,
124+
boot_args=DEFAULT_BOOT_ARGS + " init=/usr/local/bin/init rootflags=dax",
125+
enable_entropy_device=True,
126+
)
127+
vm.add_pmem("pmem", rootfs_rw, True, True)
128+
110129
vm.add_net_iface()
111130
vm.start()
112131
vm.pin_threads(0)
@@ -119,21 +138,23 @@ def launch_vm_with_boot_timer(
119138
def test_boot_timer(microvm_factory, guest_kernel_acpi, rootfs, pci_enabled):
120139
"""Tests that the boot timer device works"""
121140
launch_vm_with_boot_timer(
122-
microvm_factory, guest_kernel_acpi, rootfs, 1, 128, pci_enabled
141+
microvm_factory, guest_kernel_acpi, rootfs, 1, 128, pci_enabled, False
123142
)
124143

125144

126145
@pytest.mark.parametrize(
127146
"vcpu_count,mem_size_mib",
128147
[(1, 128), (1, 1024), (2, 2048), (4, 4096)],
129148
)
149+
@pytest.mark.parametrize("boot_from_pmem", [True, False], ids=["PmemBoot", "BlockBoot"])
130150
@pytest.mark.nonci
131151
def test_boottime(
132152
microvm_factory,
133153
guest_kernel_acpi,
134154
rootfs_rw,
135155
vcpu_count,
136156
mem_size_mib,
157+
boot_from_pmem,
137158
pci_enabled,
138159
metrics,
139160
):
@@ -147,12 +168,14 @@ def test_boottime(
147168
vcpu_count,
148169
mem_size_mib,
149170
pci_enabled,
171+
boot_from_pmem,
150172
)
151173

152174
if i == 0:
153175
metrics.set_dimensions(
154176
{
155177
"performance_test": "test_boottime",
178+
"boot_from_pmem": str(boot_from_pmem),
156179
**vm.dimensions,
157180
}
158181
)

0 commit comments

Comments
 (0)