test: add more sparse checks

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2023-09-29 20:51:03 +02:00
parent 0ef795f3a6
commit d51e814991
2 changed files with 17 additions and 3 deletions

View File

@ -67,15 +67,22 @@ test_expect_success rauc "rauc" "
exec_test_set_prereq simg2img
test_expect_success simg2img "android-sparse" "
setup_test_images &&
# make sure there is a 4*32k hole at the end
i=16
truncate --size=\$[i*(i+1)*i*i*512+32768*4] input/interleaved
for i in \`seq 16\`; do
dd if=/dev/urandom of=input/interleaved conv=notrunc seek=\$[i*i] count=\$[i] bs=\$[i*i*512] || break
done &&
dd if=/dev/urandom of=input/not-aligned count=9 bs=1024
run_genimage sparse.config &&
md5sum images/test.hdimage input/interleaved > md5sum &&
rm images/test.hdimage input/interleaved &&
check_size_range images/interleaved.sparse 9732464 9732608 &&
# simg2img will expand the partial block
truncate --size=12k input/not-aligned
md5sum images/test.hdimage input/interleaved input/not-aligned > md5sum &&
rm images/test.hdimage input/interleaved input/not-aligned &&
check_size_range images/interleaved.sparse 9732464 9732636 &&
simg2img images/test.sparse images/test.hdimage &&
simg2img images/interleaved.sparse input/interleaved &&
simg2img images/not-aligned.sparse input/not-aligned &&
md5sum -c md5sum
"

View File

@ -30,3 +30,10 @@ image interleaved.sparse {
block-size = 32k
}
}
image not-aligned.sparse {
android-sparse {
image = not-aligned
block-size = 4k
}
}