Skip to content

Commit

Permalink
test: add more sparse checks
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Olbrich <[email protected]>
  • Loading branch information
michaelolbrich committed Oct 11, 2023
1 parent 0ef795f commit d51e814
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
"

Expand Down
7 changes: 7 additions & 0 deletions test/sparse.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ image interleaved.sparse {
block-size = 32k
}
}

image not-aligned.sparse {
android-sparse {
image = not-aligned
block-size = 4k
}
}

0 comments on commit d51e814

Please sign in to comment.