Skip to content

Commit

Permalink
test: add FreeBSD/PVH boottest
Browse files Browse the repository at this point in the history
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 <roypat@amazon.co.uk>
  • Loading branch information
roypat committed Aug 25, 2023
1 parent ab1f718 commit ce3237e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/integration_tests/functional/test_pvh.py
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")

0 comments on commit ce3237e

Please sign in to comment.