-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |