1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#!/bin/bash
test_description="Filesystem Image Tests"
. "$(dirname "${0}")/test-setup.sh"
check_filelist() {
test_cmp "${filelist_orig}" "${filelist_test}"
}
exec_test_set_prereq cpio
test_expect_success cpio "cpio" "
run_genimage_root cpio.config test.cpio &&
zcat images/test.cpio | cpio --extract -t | grep -v '^\.$' | sort > '${filelist_test}' &&
check_size_range images/test.cpio 400 550 &&
check_filelist
"
exec_test_set_prereq mkfs.cramfs
test_expect_success mkfs_cramfs "cramfs" "
run_genimage_root cramfs.config test.cramfs &&
check_size images/test.cramfs 4096
"
exec_test_set_prereq genisoimage
test_expect_success genisoimage "iso" "
run_genimage_root iso.config test.iso &&
check_size_range images/test.iso 300000 400000
"
exec_test_set_prereq mkfs.f2fs
exec_test_set_prereq sload.f2fs
exec_test_set_prereq fsck.f2fs
test_expect_success mkfs_f2fs,sload_f2fs,fsck_f2fs "f2fs" "
run_genimage_root f2fs.config test.f2fs &&
fsck.f2fs images/test.f2fs
"
exec_test_set_prereq btrfs
exec_test_set_prereq mkfs.btrfs
test_expect_success mkfs_btrfs,btrfs "btrfs" "
run_genimage_root btrfs.config test.btrfs &&
btrfs check images/test.btrfs &&
test \"\$(btrfs filesystem label images/test.btrfs)\" = btrfstest &&
btrfs filesystem show images/test.btrfs | grep -q \"uuid: 47e790af-a2e1-42ff-92c7-83f45f7b2228\"
"
exec_test_set_prereq mksquashfs
test_expect_success mksquashfs "squashfs" "
run_genimage_root squashfs.config test.squashfs &&
check_size_range images/test.squashfs 4000 4100 &&
unsquashfs -ls images/test.squashfs | sed -n '/squashfs-root/s;squashfs-root/;;p' | sort > '${filelist_test}' &&
check_filelist
"
exec_test_set_prereq tar
test_expect_success tar "tar" "
run_genimage_root tar.config test.tar.gz &&
check_size_range images/test.tar.gz 500 600 &&
zcat images/test.tar.gz | tar -t | sed -n -e 's;/$;;' -e 's;^\./\(..*\)$;\1;p' | sort > '${filelist_test}' &&
check_filelist
"
exec_test_set_prereq dd
exec_test_set_prereq mkdosfs
exec_test_set_prereq mcopy
test_expect_success dd,mkdosfs,mcopy "vfat" "
run_genimage_root vfat.config test.vfat &&
fsck.fat -p images/test.vfat | tee fsck.log &&
test_must_fail grep -q 'Filesystem was changed' fsck.log &&
check_size images/test.vfat 4193280 &&
MTOOLS_SKIP_CHECK=1 mdir -/ -f -b -i images/test.vfat / | sed -e 's;^::/;;' -e 's;/$;;' | sort > '${filelist_test}' &&
check_filelist
"
exec_test_set_prereq mkfs.erofs
exec_test_set_prereq fsck.erofs
test_expect_success mkfs_erofs,fsck_erofs "erofs" "
if mkfs.erofs --help |& grep -q -- --mkfs-time; then
dump=\"${testdir}/erofs.dump.new\"
config=erofs.new.config
else
dump=\"${testdir}/erofs.dump.old\"
config=erofs.old.config
fi
SOURCE_DATE_EPOCH=946684800 run_genimage_root \"\${config}\" test.erofs &&
fsck.erofs -p images/test.erofs | tee erofs.log &&
test_must_fail grep -q 'Filesystem was changed' erofs.log &&
check_size images/test.erofs 8192 &&
dump.erofs -s -S --ls --path=/ images/test.erofs | sed 's/-nan/nan/' > erofs.dump &&
test_cmp \"\${dump}\" erofs.dump
"
test_done
# vim: syntax=sh
|