summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fsck-tests.sh15
-rw-r--r--tests/fsck-tests/006-bad_root_items_fs.tar.xzbin0 -> 24980 bytes
-rw-r--r--tests/fsck-tests/007-bad_root_items_fs_skinny.tar.xzbin0 -> 26520 bytes
3 files changed, 13 insertions, 2 deletions
diff --git a/tests/fsck-tests.sh b/tests/fsck-tests.sh
index 867366b9..3f04626e 100644
--- a/tests/fsck-tests.sh
+++ b/tests/fsck-tests.sh
@@ -27,12 +27,23 @@ rm -f $RESULT
# test rely on corrupting blocks tool
run_check make btrfs-corrupt-block
-for i in $(find $here/tests/fsck-tests -name '*.img')
+# Some broken filesystem images are kept as .img files, created by the tool
+# btrfs-image, and others are kept as .tar.xz files that contain raw filesystem
+# image (the backing file of a loop device, as a sparse file). The reason for
+# keeping some as tarballs of raw images is that for these cases btrfs-image
+# isn't able to preserve all the (bad) filesystem structure for some reason.
+for i in $(find $here/tests/fsck-tests -name '*.img' -o -name '*.tar.xz')
do
echo " [TEST] $(basename $i)"
echo "testing image $i" >> $RESULT
- run_check $here/btrfs-image -r $i test.img
+ extension=${i#*.}
+
+ if [ $extension == "img" ]; then
+ run_check $here/btrfs-image -r $i test.img
+ else
+ run_check tar xJf $i
+ fi
$here/btrfsck test.img >> $RESULT 2>&1
[ $? -eq 0 ] && _fail "btrfsck should have detected corruption"
diff --git a/tests/fsck-tests/006-bad_root_items_fs.tar.xz b/tests/fsck-tests/006-bad_root_items_fs.tar.xz
new file mode 100644
index 00000000..125d8e7d
--- /dev/null
+++ b/tests/fsck-tests/006-bad_root_items_fs.tar.xz
Binary files differ
diff --git a/tests/fsck-tests/007-bad_root_items_fs_skinny.tar.xz b/tests/fsck-tests/007-bad_root_items_fs_skinny.tar.xz
new file mode 100644
index 00000000..ed99dc4d
--- /dev/null
+++ b/tests/fsck-tests/007-bad_root_items_fs_skinny.tar.xz
Binary files differ