You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
1.0 KiB
23 lines
1.0 KiB
package main
|
|
|
|
import "testing"
|
|
|
|
func TestRecoveryPartitionContractMatchesMeasuredTargetGPT(t *testing.T) {
|
|
want := []recoveryPartition{
|
|
{DevicePath: "/dev/mmcblk0p2", UEventPath: "/sys/class/block/mmcblk0p2/uevent", Name: "misc"},
|
|
{DevicePath: "/dev/mmcblk0p3", UEventPath: "/sys/class/block/mmcblk0p3/uevent", Name: "boot"},
|
|
{DevicePath: "/dev/mmcblk0p6", UEventPath: "/sys/class/block/mmcblk0p6/uevent", Name: "rootfs"},
|
|
{DevicePath: "/dev/mmcblk0p8", UEventPath: "/sys/class/block/mmcblk0p8/uevent", Name: "userdata"},
|
|
}
|
|
if len(recoveryPartitionContract) != len(want) {
|
|
t.Fatalf("partition contract count=%d want=%d", len(recoveryPartitionContract), len(want))
|
|
}
|
|
for index := range want {
|
|
if recoveryPartitionContract[index] != want[index] {
|
|
t.Fatalf("partition contract[%d]=%+v want=%+v", index, recoveryPartitionContract[index], want[index])
|
|
}
|
|
}
|
|
if bootSizePath != "/sys/class/block/mmcblk0p3/size" || rootfsSizePath != "/sys/class/block/mmcblk0p6/size" {
|
|
t.Fatalf("size paths boot=%q rootfs=%q", bootSizePath, rootfsSizePath)
|
|
}
|
|
}
|
|
|