test: add tests for --includepath

Also ensure --includepath is rejected when it is not supported.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
This commit is contained in:
Rasmus Villemoes 2021-06-04 21:46:29 +02:00
parent 9e7f23aa98
commit f1cab39558
9 changed files with 68 additions and 0 deletions

View File

@ -92,6 +92,13 @@ EXTRA_DIST += \
test/hdimage-fail5.config \
test/hdimage-fail6.config \
test/hdimage-fail7.config \
test/include-aaa.fdisk \
test/include-bbb.fdisk \
test/include-ccc.fdisk \
test/include-test.config \
test/include.config \
test/include/aaa/include-test.config \
test/include/bbb/include-test.config \
test/iso.config \
test/jffs2.config \
test/jffs2.md5 \

View File

@ -43,6 +43,7 @@ run_genimage() {
--inputpath=input \
--rootpath=root \
--tmppath=tmp \
${extra_opts} \
--config "${1}"
}
@ -495,6 +496,38 @@ test_expect_success "bootloader-hole5" "
setup_gpt_files &&
OFFSET=128K run_genimage hole.config"
"$genimage" --help | grep -q 'GENIMAGE_INCLUDEPATH' && test_set_prereq "includepath"
test_expect_success fdisk-gpt,sfdisk-gpt "includepath1" "
run_genimage include.config &&
sanitized_fdisk_sfdisk images/include.hdimage > include.fdisk &&
test_cmp '${testdir}/include-ccc.fdisk' include.fdisk
"
test_expect_success fdisk-gpt,sfdisk-gpt,includepath "includepath2" "
extra_opts='--includepath=${testdir}/include/aaa' run_genimage include.config &&
sanitized_fdisk_sfdisk images/include.hdimage > include.fdisk &&
test_cmp '${testdir}/include-aaa.fdisk' include.fdisk
"
test_expect_success fdisk-gpt,sfdisk-gpt,includepath "includepath3" "
extra_opts='--includepath=${testdir}/include/bbb:${testdir}/include/aaa' run_genimage include.config &&
sanitized_fdisk_sfdisk images/include.hdimage > include.fdisk &&
test_cmp '${testdir}/include-bbb.fdisk' include.fdisk
"
test_expect_success fdisk-gpt,sfdisk-gpt,includepath "includepath4" "
extra_opts='--includepath=.:${testdir}/include/bbb' run_genimage include.config &&
sanitized_fdisk_sfdisk images/include.hdimage > include.fdisk &&
test_cmp '${testdir}/include-ccc.fdisk' include.fdisk
"
test_expect_success !includepath "includepath5" "
extra_opts='--includepath=${testdir}/include/aaa' test_must_fail run_genimage include.config
"
test_done
# vim: syntax=sh

2
test/include-aaa.fdisk Normal file
View File

@ -0,0 +1,2 @@
Disk identifier: 6A921DBB-823D-44C4-8EDC-ECB038E6D743
images/include.hdimage1:start=34,size=2048,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4,uuid=59DA602D-C2EA-4F18-818F-CF7947BAD0CA,name="aaa"

2
test/include-bbb.fdisk Normal file
View File

@ -0,0 +1,2 @@
Disk identifier: 6A921DBB-823D-44C4-8EDC-ECB038E6D743
images/include.hdimage1:start=34,size=4096,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4,uuid=284635E9-6B62-41CA-A02A-357C01517279,name="bbb"

2
test/include-ccc.fdisk Normal file
View File

@ -0,0 +1,2 @@
Disk identifier: 6A921DBB-823D-44C4-8EDC-ECB038E6D743
images/include.hdimage1:start=34,size=6144,type=0FC63DAF-8483-4772-8E79-3D69D8477DE4,uuid=088813B5-7028-4540-99DA-B10015FD07DA,name="ccc"

5
test/include-test.config Normal file
View File

@ -0,0 +1,5 @@
partition ccc {
size = 3M
partition-type-uuid = "L"
partition-uuid = "088813b5-7028-4540-99da-b10015fd07da"
}

7
test/include.config Normal file
View File

@ -0,0 +1,7 @@
image include.hdimage {
hdimage {
partition-table-type = "gpt"
disk-uuid = "6a921dbb-823d-44c4-8edc-ecb038e6d743"
}
include("include-test.config")
}

View File

@ -0,0 +1,5 @@
partition aaa {
size = 1M
partition-type-uuid = "L"
partition-uuid = "59da602d-c2ea-4f18-818f-cf7947bad0ca"
}

View File

@ -0,0 +1,5 @@
partition bbb {
size = 2M
partition-type-uuid = "L"
partition-uuid = "284635e9-6b62-41ca-a02a-357c01517279"
}