Skip to content

Commit

Permalink
gadget: add install-mode tests for volume assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Oct 2, 2024
1 parent 31408df commit a1e1c31
Show file tree
Hide file tree
Showing 2 changed files with 346 additions and 75 deletions.
129 changes: 128 additions & 1 deletion gadget/gadgettest/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,49 @@ volumes:
size: 256M
`

// from a rpi without the kernel assets or content layout for simplicity's sake
const RaspiSimplifiedMultiVolumeAssignmentYaml = `
volumes:
pi:
bootloader: u-boot
schema: mbr
structure:
- filesystem: vfat
name: ubuntu-seed
role: system-seed
size: 1200M
type: 0C
- filesystem: vfat
name: ubuntu-boot
role: system-boot
size: 750M
type: 0C
- filesystem: ext4
name: ubuntu-save
role: system-save
size: 16M
type: 83,0FC63DAF-8483-4772-8E79-3D69D8477DE4
- filesystem: ext4
name: ubuntu-data
role: system-data
size: 1500M
type: 83,0FC63DAF-8483-4772-8E79-3D69D8477DE4
backup:
schema: mbr
structure:
- filesystem: ext4
name: system-backup
size: 127M
type: 83,0FC63DAF-8483-4772-8E79-3D69D8477DE4
volume-assignments:
- name: raspi
assignment:
pi:
device: /dev/disk/by-path/pci-42:0
backup:
device: /dev/disk/by-path/pci-43:0
`

const RaspiSimplifiedMultiVolumeAssignmentNoSaveYaml = `
volumes:
pi:
bootloader: u-boot
Expand Down Expand Up @@ -752,6 +793,92 @@ const ExpectedLUKSEncryptedRaspiDiskVolumeDeviceTraitsJSON = `
`

const ExpectedRaspiDiskVolumeMultiVolumeDeviceTraitsJSON = `
{
"pi": {
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
"kernel-path": "/dev/mmcblk0",
"disk-id": "7c301cbd",
"size": 32010928128,
"sector-size": 512,
"schema": "dos",
"structure-encryption": {},
"structure": [
{
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1",
"kernel-path": "/dev/mmcblk0p1",
"partition-uuid": "7c301cbd-01",
"partition-label": "",
"partition-type": "0C",
"filesystem-label": "ubuntu-seed",
"filesystem-uuid": "0E09-0822",
"filesystem-type": "vfat",
"offset": 1048576,
"size": 1258291200
},
{
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2",
"kernel-path": "/dev/mmcblk0p2",
"partition-uuid": "7c301cbd-02",
"partition-label": "",
"partition-type": "0C",
"filesystem-label": "ubuntu-boot",
"filesystem-uuid": "23F9-881F",
"filesystem-type": "vfat",
"offset": 1259339776,
"size": 786432000
},
{
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3",
"kernel-path": "/dev/mmcblk0p3",
"partition-uuid": "7c301cbd-03",
"partition-label": "",
"partition-type": "83",
"filesystem-label": "ubuntu-save",
"filesystem-uuid": "1cdd5826-e9de-4d27-83f7-20249e710590",
"filesystem-type": "ext4",
"offset": 2045771776,
"size": 16777216
},
{
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4",
"kernel-path": "/dev/mmcblk0p4",
"partition-uuid": "7c301cbd-04",
"partition-label": "",
"partition-type": "83",
"filesystem-label": "ubuntu-data",
"filesystem-uuid": "d7f39661-1da0-48de-8967-ce41343d4345",
"filesystem-type": "ext4",
"offset": 2062548992,
"size": 29948379136
}
]
},
"backup": {
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc1/mmc1:0001/block/mmcblk1",
"kernel-path": "/dev/mmcblk1",
"disk-id": "7c301cbe",
"size": 134217728,
"sector-size": 512,
"schema": "dos",
"structure": [
{
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc1/mmc1:0001/block/mmcblk1/mmcblk1p1",
"kernel-path": "/dev/mmcblk1p1",
"partition-uuid": "7c301cbe-01",
"partition-label": "",
"partition-type": "83",
"filesystem-label": "system-backup",
"filesystem-uuid": "1cdd5826-e9de-4d27-83f7-20249e710591",
"filesystem-type": "ext4",
"offset": 1048576,
"size": 133169152
}
]
}
}
`

const ExpectedRaspiDiskVolumeMultiVolumeDeviceNoSaveTraitsJSON = `
{
"pi": {
"device-path": "/sys/devices/platform/emmc2bus/fe340000.emmc2/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
Expand Down
Loading

0 comments on commit a1e1c31

Please sign in to comment.