Skip to content

Commit

Permalink
test: Add Linux on PVH test
Browse files Browse the repository at this point in the history
Add a test that verifies that firecracker can boot a PVH-enabled linux,
and assert that it actually used the PVH boot protocol.

Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Sep 7, 2023
1 parent c3dbe53 commit e2167f0
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion tests/integration_tests/functional/test_pvh.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest

from conftest import guest_kernel_fxt
from framework import defs
from framework.artifacts import NetIfaceConfig
from framework.microvm import Serial
Expand All @@ -29,6 +30,36 @@ def uvm_freebsd(microvm_factory, artifact_dir):
)


pvh_kernel_params = [
pytest.param(path, id=path.name)
for path in defs.ARTIFACT_DIR.rglob("vmlinux-*-pvh")
]
pvh_guest_kernel = pytest.fixture(guest_kernel_fxt, params=pvh_kernel_params)


@pytest.fixture
def uvm_pvh(microvm_factory, pvh_guest_kernel, rootfs):
"""Create a Linux/PVH microvm"""
return microvm_factory.build(pvh_guest_kernel, rootfs)


def test_linux_pvh_boot(uvm_pvh):
"""
Tests booting a PVH-enabled linux kernel for supported guest kernel version 5.10 and newer (as non-XEN PVH
support was added to linux in 5.0).
Asserts that the 'Kernel loaded using PVH boot protocol' log message is present
"""
uvm_pvh.spawn()
uvm_pvh.basic_config()
uvm_pvh.add_net_iface()
uvm_pvh.start()

uvm_pvh.ssh.run("true")

uvm_pvh.check_log_message("Kernel loaded using PVH boot protocol")


def test_freebsd_pvh_boot(uvm_freebsd):
"""Tries to boot a FreeBSD microVM"""
freebsd_iface = NetIfaceConfig(
Expand All @@ -47,4 +78,4 @@ def test_freebsd_pvh_boot(uvm_freebsd):
# SSH-ing into it. Therefore, we use the serial console and look for the login-prompt.
serial = Serial(uvm_freebsd)
serial.open()
serial.rx("login: ")
serial.rx("login: ")

0 comments on commit e2167f0

Please sign in to comment.