-
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.
Adds a test that attempts to boot a FreeBSD microvm inside of firecracker. FreeBSD boots using PVH, so this is implicitly also a test of the PVH support. Signed-off-by: Patrick Roy <[email protected]>
- Loading branch information
Showing
1 changed file
with
43 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,43 @@ | ||
# 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 framework import defs | ||
from framework.artifacts import NetIfaceConfig | ||
from framework.properties import global_props | ||
|
||
pytestmark = pytest.mark.skipif( | ||
global_props.cpu_architecture != "x86_64", reason="x86_64 specific tests" | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def uvm_freebsd(microvm_factory): | ||
"""Create a FreeBSD microVM""" | ||
|
||
# Cant use the rootfs_fxt and guest_kernel_fxt, because they only allow us to get supported kernels (and I am | ||
# reluctant to add a freebsd regex to the list of supported kernels) | ||
return microvm_factory.build( | ||
defs.ARTIFACT_DIR / "freebsd/freebsd-kern.bin", | ||
defs.ARTIFACT_DIR / "freebsd/freebsd-rootfs.bin", | ||
) | ||
|
||
|
||
def test_freebsd_pvh_boot(uvm_freebsd): | ||
"""Tries to boot a FreeBSD microVM""" | ||
|
||
freebsd_iface = NetIfaceConfig( | ||
host_ip="10.0.0.1", guest_ip="10.0.0.2", tap_name="tap0", dev_name="eth0" | ||
) | ||
|
||
uvm_freebsd.spawn() | ||
uvm_freebsd.basic_config(boot_args="vfs.root.mountfrom=ufs:/dev/vtbd0") | ||
uvm_freebsd.add_net_iface(iface=freebsd_iface) | ||
uvm_freebsd.start() | ||
|
||
uvm_freebsd.ssh.run("true") |