From 879d19a7f015be003e33daa678e9793bf910fbf6 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 2 Oct 2024 15:14:46 +0200 Subject: [PATCH] WIP installation on a disk with a MBR partition --- tests/install/conftest.py | 15 +++++++++++++++ tests/install/test.py | 11 ++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/install/conftest.py b/tests/install/conftest.py index 9a23a086..338273d5 100644 --- a/tests/install/conftest.py +++ b/tests/install/conftest.py @@ -129,6 +129,9 @@ def answerfile_maybe_tweak_parttable(request, answerfile): if firmware.endswith("+dell"): answerfile.top_append(dict(TAG="script", stage="installation-start", type="url", CONTENTS="file:///root/preinstall-utilitypart.sh")) + if firmware.endswith("+mbr"): + answerfile.top_append(dict(TAG="script", stage="installation-start", + type="url", CONTENTS="file:///root/preinstall-mbrparttable.sh")) # Remasters the ISO sepecified by `installer_iso` mark, with: # - network and ssh support activated, and .ssh/authorized_key so tests can @@ -251,6 +254,18 @@ def remastered_iso(installer_iso, answerfile, install_disk): EOP EOF +cat > "$INSTALLIMG/root/preinstall-mbrparttable.sh" <<'EOF' +#!/bin/sh +set -ex + +# Dell utility partition +sgdisk --zap-all /dev/{install_disk} +sfdisk /dev/{install_disk} << 'EOP' +unit: sectors +p1 : start= 2048, size= 32768, Id=83 +EOP +EOF + cat > "$INSTALLIMG/root/postinstall.sh" <<'EOF' #!/bin/sh set -ex diff --git a/tests/install/test.py b/tests/install/test.py index e9efa2da..a787fd12 100644 --- a/tests/install/test.py +++ b/tests/install/test.py @@ -32,7 +32,7 @@ class TestNested: "xs8", "ch821.1", "xs70", )) - @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell")) + @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell", "bios+mbr")) @pytest.mark.vm_definitions(lambda firmware: dict( name="vm1", template="Other install media", @@ -52,6 +52,7 @@ class TestNested: ), "bios": (), "bios+dell": (), + "bios+mbr": (), }[firmware], vdis=[dict(name="vm1 system disk", size="100GiB", device="xvda", userdevice="0")], cd_vbd=dict(device="xvdd", userdevice="3"), @@ -111,7 +112,7 @@ def helper_vm_with_plugged_disk(running_vm, create_vms): "ch821.1", "xs8", "xs70", )) - @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell")) + @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell", "bios+mbr")) @pytest.mark.continuation_of(lambda version, firmware, local_sr, source_type: [dict( vm="vm1", image_test=f"TestNested::test_install[{firmware}-{version}-{source_type}-{local_sr}]")], @@ -304,7 +305,7 @@ def _test_firstboot(self, create_vms, mode, *, machine='DEFAULT'): "ch821.1", "xs8", "xs70", )) - @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell")) + @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell", "bios+mbr")) @pytest.mark.continuation_of( lambda version, firmware, machine, local_sr, source_type: [ dict(vm="vm1", @@ -333,7 +334,7 @@ def test_boot_inst(self, create_vms, "821.1-821.1", "75-821.1", )) - @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell")) + @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell", "bios+mbr")) @pytest.mark.continuation_of(lambda mode, firmware, machine, source_type, local_sr: [dict( vm="vm1", image_test=(f"TestNested::test_upgrade[{firmware}-{mode}-{machine}-{source_type}-{local_sr}]"))], @@ -389,7 +390,7 @@ def test_boot_rst(self, create_vms, ("821.1", "821.1"), ("75", "821.1"), ]) - @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell")) + @pytest.mark.parametrize("firmware", ("uefi", "bios", "bios+dell", "bios+mbr")) @pytest.mark.continuation_of(lambda firmware, params, machine, source_type, local_sr: [dict( vm="vm1", image_test=(f"TestNested::test_boot_{'upg' if '-' in params else 'inst'}"