|
31 | 31 |
|
32 | 32 | import host_tools.cargo_build as build_tools |
33 | 33 | from framework import defs, utils |
34 | | -from framework.artifacts import disks, kernel_params |
| 34 | +from framework.artifacts import disk_params, kernel_params |
35 | 35 | from framework.defs import ARTIFACT_DIR, DEFAULT_BINARY_DIR |
36 | 36 | from framework.microvm import HugePagesConfig, MicroVMFactory, SnapshotType |
37 | 37 | from framework.properties import global_props |
@@ -512,26 +512,33 @@ def guest_kernel_fxt(request, record_property): |
512 | 512 | ) |
513 | 513 |
|
514 | 514 |
|
515 | | -@pytest.fixture |
516 | | -def rootfs(): |
517 | | - """Return an Ubuntu 24.04 read-only rootfs""" |
518 | | - disk_list = disks("ubuntu-24.04.squashfs") |
519 | | - if not disk_list: |
520 | | - pytest.fail( |
521 | | - f"No disk artifacts found matching 'ubuntu-24.04.squashfs' in {ARTIFACT_DIR}" |
522 | | - ) |
523 | | - return disk_list[0] |
| 515 | +def rootfs_fxt(request): |
| 516 | + """Return a read-only rootfs.""" |
| 517 | + if request.param is None: |
| 518 | + pytest.fail(f"No disk artifacts found in {ARTIFACT_DIR}") |
| 519 | + return request.param |
524 | 520 |
|
525 | 521 |
|
526 | | -@pytest.fixture |
527 | | -def rootfs_rw(): |
528 | | - """Return an Ubuntu 24.04 ext4 rootfs""" |
529 | | - disk_list = disks("ubuntu-24.04.ext4") |
530 | | - if not disk_list: |
531 | | - pytest.fail( |
532 | | - f"No disk artifacts found matching 'ubuntu-24.04.ext4' in {ARTIFACT_DIR}" |
533 | | - ) |
534 | | - return disk_list[0] |
| 522 | +rootfs_ubuntu = pytest.fixture(rootfs_fxt, params=disk_params("ubuntu*.squashfs")) |
| 523 | +rootfs_al = pytest.fixture(rootfs_fxt, params=disk_params("amazonlinux*.squashfs")) |
| 524 | +rootfs_any = pytest.fixture(rootfs_fxt, params=disk_params("*.squashfs")) |
| 525 | + |
| 526 | +# Default ro rootfs used by tests |
| 527 | +rootfs = rootfs_ubuntu |
| 528 | + |
| 529 | + |
| 530 | +def rootfs_rw_fxt(request): |
| 531 | + """Return a writeable rootfs.""" |
| 532 | + if request.param is None: |
| 533 | + pytest.fail(f"No disk artifacts found in {ARTIFACT_DIR}") |
| 534 | + return request.param |
| 535 | + |
| 536 | + |
| 537 | +rootfs_rw_ubuntu = pytest.fixture(rootfs_rw_fxt, params=disk_params("ubuntu*.ext4")) |
| 538 | +rootfs_rw_al = pytest.fixture(rootfs_rw_fxt, params=disk_params("amazonlinux*.ext4")) |
| 539 | + |
| 540 | +# Default rw rootfs used by tests |
| 541 | +rootfs_rw = rootfs_rw_ubuntu |
535 | 542 |
|
536 | 543 |
|
537 | 544 | @pytest.fixture |
@@ -575,12 +582,12 @@ def artifact_dir(): |
575 | 582 |
|
576 | 583 |
|
577 | 584 | @pytest.fixture |
578 | | -def uvm_plain_any(microvm_factory, guest_kernel, rootfs, pci_enabled): |
579 | | - """All guest kernels |
| 585 | +def uvm_plain_any(microvm_factory, guest_kernel, rootfs_any, pci_enabled): |
| 586 | + """All guest kernels and rootfs |
580 | 587 | kernel: all |
581 | | - rootfs: Ubuntu 24.04 |
| 588 | + rootfs: Ubuntu 24.04 OR Amazon Linux 2023 |
582 | 589 | """ |
583 | | - return microvm_factory.build(guest_kernel, rootfs, pci=pci_enabled) |
| 590 | + return microvm_factory.build(guest_kernel, rootfs_any, pci=pci_enabled) |
584 | 591 |
|
585 | 592 |
|
586 | 593 | guest_kernel_6_1_debug = pytest.fixture( |
|
0 commit comments