3 # loop through all of our bad images and make sure fsck repairs them properly
5 # It's GPL, same as everything else in this tree.
11 SCRIPT_DIR=$(dirname $(readlink -f $0))
12 TOP=$(readlink -f $SCRIPT_DIR/../)
13 TEST_DEV=${TEST_DEV:-}
14 TEST_MNT=${TEST_MNT:-$TOP/tests/mnt}
15 RESULTS="$TOP/tests/fsck-tests-results.txt"
17 source $TOP/tests/common
19 # Allow child test to use $TOP and $RESULTS
22 # For custom script needs to verfiy recovery
27 mkdir -p $TEST_MNT || _fail "unable to create mount point on $TEST_MNT"
29 # test rely on corrupting blocks tool
30 check_prereq btrfs-corrupt-block
31 check_prereq btrfs-image
34 # Each dir contains one type of error for btrfsck test.
35 # Each dir must be one of the following 2 types:
36 # 1) Only btrfs-image dump
37 # Only contains one or several btrfs-image dumps (.img)
38 # Each image will be tested by generic test routine
39 # (btrfsck --repair and btrfsck).
40 # This is for case that btree-healthy images.
41 # 2) Custom test script
42 # This dir contains test.sh which will do custom image
43 # generation/check/verification.
44 # This is for case btrfs-image can't dump or case needs extra
47 for i in $(find $TOP/tests/fsck-tests -maxdepth 1 -mindepth 1 -type d | sort)
49 echo " [TEST] $(basename $i)"
51 echo "=== Entering $i" >> $RESULTS
52 if [ -x test.sh ]; then
56 _fail "test failed for case $(basename $i)"
60 check_all_images `pwd`