| 
7 | 7 | import pytest  | 
8 | 8 | 
 
  | 
9 | 9 | from framework import utils  | 
10 |  | -from framework.microvm import HugePagesConfig  | 
 | 10 | +from framework.microvm import HugePagesConfig, Serial  | 
11 | 11 | from framework.properties import global_props  | 
12 | 12 | from framework.utils_ftrace import ftrace_events  | 
 | 13 | +from integration_tests.functional.test_initrd import INITRD_FILESYSTEM  | 
13 | 14 | from integration_tests.functional.test_uffd import SOCKET_PATH, spawn_pf_handler  | 
14 | 15 | 
 
  | 
15 | 16 | 
 
  | 
@@ -259,33 +260,19 @@ def test_negative_huge_pages_plus_initrd(uvm_with_initrd):  | 
259 | 260 |     uvm_with_initrd.spawn()  | 
260 | 261 |     uvm_with_initrd.memory_monitor = None  | 
261 | 262 | 
 
  | 
262 |  | -    # Ensure setting huge pages and then telling FC to boot an initrd does not work  | 
263 |  | -    with pytest.raises(  | 
264 |  | -        RuntimeError,  | 
265 |  | -        match="Boot source error: Firecracker's huge pages support is incompatible with initrds.",  | 
266 |  | -    ):  | 
267 |  | -        # `basic_config` first does a PUT to /machine-config, which will apply the huge pages configuration,  | 
268 |  | -        # and then a PUT to /boot-source, which will register the initrd  | 
269 |  | -        uvm_with_initrd.basic_config(  | 
270 |  | -            boot_args="console=ttyS0 reboot=k panic=1 pci=off",  | 
271 |  | -            use_initrd=True,  | 
272 |  | -            huge_pages=HugePagesConfig.HUGETLBFS_2MB,  | 
273 |  | -            add_root_device=False,  | 
274 |  | -            vcpu_count=1,  | 
275 |  | -        )  | 
276 |  | - | 
277 |  | -    # Ensure telling FC about the initrd first and then setting huge pages doesn't work  | 
278 |  | -    # This first does a PUT to /machine-config to reset the huge pages configuration, before doing a  | 
279 |  | -    # PUT to /boot-source to register the initrd  | 
 | 263 | +    # `basic_config` first does a PUT to /machine-config, which will apply the huge pages configuration,  | 
 | 264 | +    # and then a PUT to /boot-source, which will register the initrd  | 
280 | 265 |     uvm_with_initrd.basic_config(  | 
281 |  | -        huge_pages=HugePagesConfig.NONE,  | 
282 | 266 |         boot_args="console=ttyS0 reboot=k panic=1 pci=off",  | 
283 | 267 |         use_initrd=True,  | 
 | 268 | +        huge_pages=HugePagesConfig.HUGETLBFS_2MB,  | 
 | 269 | +        add_root_device=False,  | 
 | 270 | +        vcpu_count=1,  | 
284 | 271 |     )  | 
285 |  | -    with pytest.raises(  | 
286 |  | -        RuntimeError,  | 
287 |  | -        match="Machine config error: Firecracker's huge pages support is incompatible with initrds.",  | 
288 |  | -    ):  | 
289 |  | -        uvm_with_initrd.api.machine_config.patch(  | 
290 |  | -            huge_pages=HugePagesConfig.HUGETLBFS_2MB  | 
291 |  | -        )  | 
 | 272 | + | 
 | 273 | +    uvm_with_initrd.start()  | 
 | 274 | +    serial = Serial(uvm_with_initrd)  | 
 | 275 | +    serial.open()  | 
 | 276 | +    serial.rx(token="# ")  | 
 | 277 | +    serial.tx("mount |grep rootfs")  | 
 | 278 | +    serial.rx(token=f"rootfs on / type {INITRD_FILESYSTEM}")  | 
0 commit comments