mkapfs: run tests on fusion drives as well

Expand the existing test script to run tests on fusion drives as well,
going through all possible combinations of the size array. Of course
these specific sizes are not as relevant for fusion drives, because they
were picked as the critical points where the layout changes for regular
drives, but hopefully it will be enough to cover everything.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
This commit is contained in:
Ernesto A. Fernández
2024-10-11 19:48:36 -03:00
parent 0024ee734f
commit f523ce4693
+15
View File
@@ -13,6 +13,7 @@ success=0
set -e
cleanup() {
rm -f /tmp/sizetest.img
rm -f /tmp/sizetest2.img
[ $success -eq 1 ] && echo "TEST PASSED" || echo "TEST FAILED"
}
trap cleanup exit
@@ -23,6 +24,13 @@ test_size() {
../apfsck/apfsck -cuw /tmp/sizetest.img
}
test_fusion_sizes() {
truncate -s $1 /tmp/sizetest.img
truncate -s $2 /tmp/sizetest2.img
./mkapfs -F /tmp/sizetest2.img /tmp/sizetest.img
../apfsck/apfsck -cuw -F /tmp/sizetest2.img /tmp/sizetest.img
}
# Single block ip bitmap, single block spaceman, no CABs
sizes[0]=512K # Minimum size
sizes[1]=15G
@@ -52,4 +60,11 @@ for sz in ${sizes[@]}; do
test_size $sz
done
touch /tmp/sizetest2.img
for sz1 in ${sizes[@]}; do
for sz2 in ${sizes[@]}; do
test_fusion_sizes $sz1 $sz2
done
done
success=1