From 90297419db5a11eb6ec2ef46c8719751608dd83b 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 ce9d7843..49fe1e37 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", @@ -53,6 +53,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"), @@ -113,7 +114,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", @@ -307,7 +308,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", @@ -337,7 +338,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", @@ -395,7 +396,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",