From 396bf430a1ae7bd2754980f4d9d0bfb0fbe11f70 Mon Sep 17 00:00:00 2001 From: Julien Massot Date: Wed, 19 Feb 2025 08:08:55 +0100 Subject: [PATCH] Add test for partitioning with alternate sector size parted will return an error code if the partition table is not found, and will print the message: "unrecognised disk label" Signed-off-by: Julien Massot --- .github/workflows/ci.yaml | 4 ++++ tests/partitioning-sector-size/test.yaml | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/partitioning-sector-size/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index da946ae..0a3fffd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -176,6 +176,10 @@ jobs: test: { name: "arch", case: "arch" } - backend: kvm test: { name: "apertis", case: "apertis" } + - backend: kvm + test: { name: "512 sector size GPT partition table", case: "partitioning-sector-size", variables: "-t sectorsize:512" } + - backend: kvm + test: { name: "4096 sector size GPT partition table", case: "partitioning-sector-size", variables: "-t sectorsize:4096" } name: ${{matrix.test.name}} on ${{matrix.backend}} runs-on: 'ubuntu-latest' steps: diff --git a/tests/partitioning-sector-size/test.yaml b/tests/partitioning-sector-size/test.yaml new file mode 100644 index 0000000..6745c15 --- /dev/null +++ b/tests/partitioning-sector-size/test.yaml @@ -0,0 +1,23 @@ +{{ $sectorsize := or .sectorsize 512 }} +architecture: amd64 +sectorsize: {{ $sectorsize }} +actions: + - action: image-partition + description: Create a {{ $sectorsize }} sector size image + imagename: test.img + imagesize: 10M + partitiontype: gpt + partitions: + - name: system + fs: ext4 + start: 2m + end: 100% +# +# Would more elegant to check the sector size with +# sfdisk --sector-size {{ $sectorsize }} -J test.img | jq .partitiontable.sectorsize +# once we have an updated sfdisk that supports this option see: +# https://www.kernel.org/pub/linux/utils/util-linux/v2.41/v2.41-ReleaseNotes + - action: run + description: Print partition table + chroot: false + command: bash -c 'PARTED_SECTOR_SIZE={{ $sectorsize }} parted -s ${ARTIFACTDIR}/test.img print'