tests: add test for msdos partitioning

Add a test for partitioning an msdos label with more then 4 partitions.
The expectation is that the 4th partition will be an extended partition
in this case.
This commit is contained in:
Sjoerd Simons
2023-12-30 22:27:16 +01:00
parent da773ccbc8
commit 9051908056
3 changed files with 117 additions and 0 deletions

View File

@@ -128,9 +128,13 @@ jobs:
- { name: "debian (amd64)", case: "debian", variables: "-t architecture:amd64" }
- { name: "debian (arm64)", case: "debian", variables: "-t architecture:arm64" }
- { name: "debian (armhf)", case: "debian", variables: "-t architecture:armhf" }
- { name: "partitioning", case: "partitioning" }
- { name: "msdos partitioning", case: "msdos" }
exclude:
- backend: nofakemachine
test: { name: "partitioning", case: "partitioning" }
- backend: nofakemachine
test: { name: "msdos partitioning", case: "msdos" }
include:
- backend: kvm
test: { name: "arch", case: "arch" }

57
tests/msdos/expected.json Normal file
View File

@@ -0,0 +1,57 @@
{
"partitiontable": {
"label": "dos",
"id": "0xdeadbeef",
"device": "test.img",
"unit": "sectors",
"sectorsize": 512,
"partitions": [
{
"node": "test.img1",
"start": 1,
"size": 500000,
"type": "83"
},{
"node": "test.img2",
"start": 500001,
"size": 3406250,
"type": "83"
},{
"node": "test.img3",
"start": 3906251,
"size": 1953125,
"type": "83"
},{
"node": "test.img4",
"start": 5859376,
"size": 9765624,
"type": "f"
},{
"node": "test.img5",
"start": 5859377,
"size": 1953124,
"type": "83"
},{
"node": "test.img6",
"start": 7812502,
"size": 1953124,
"type": "83"
},{
"node": "test.img7",
"start": 9765627,
"size": 1953124,
"type": "83"
},{
"node": "test.img8",
"start": 11718752,
"size": 1953124,
"type": "83"
},{
"node": "test.img9",
"start": 13671877,
"size": 1953123,
"type": "83"
}
]
}
}

56
tests/msdos/test.yaml Normal file
View File

@@ -0,0 +1,56 @@
architecture: amd64
actions:
- action: image-partition
description: Partition the image
imagename: test.img
imagesize: 8G
partitiontype: msdos
diskid: deadbeef
mountpoints:
- mounpoint: /
partition: system
partitions:
- name: boot
fs: ext2
start: 0%
end: 256M
- name: system
fs: ext4
start: 256m
end: 2G
- name: data0
fs: ext4
start: 2G
end: 3G
- name: data1
fs: ext4
start: 3G
end: 4G
- name: data2
fs: ext4
start: 4G
end: 5G
- name: data3
fs: ext4
start: 5G
end: 6G
- name: data4
fs: ext4
start: 6G
end: 7G
- name: data5
fs: ext4
start: 7G
end: 8G
- action: run
chroot: false
command: >
cd ${ARTIFACTDIR};
sfdisk -J test.img | tee ${RECIPEDIR}/actual.json
- action: run
description: Compare expected and actual
chroot: false
command: bash -c 'diff -u <(jq . ${RECIPEDIR}/expected.json) <(jq . ${RECIPEDIR}/actual.json)'