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 bf5c4fb commit cbe7656
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/integration_tests/functional/test_pvh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""Tests for PVH boot mode"""

# pylint:disable=redefined-outer-name

import pytest

from conftest import guest_kernel_fxt
from framework import defs
from framework.properties import global_props

pytestmark = pytest.mark.skipif(
global_props.cpu_architecture != "x86_64", reason="x86_64 specific tests"
)

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")

0 comments on commit cbe7656

Please sign in to comment.