3 # loop through all of our bad images and make sure fsck repairs them properly
6 SCRIPT_DIR=$(dirname $(readlink -f "$0"))
7 TOP=$(readlink -f "$SCRIPT_DIR/../")
9 RESULTS="$TOP/tests/fsck-tests-results.txt"
10 IMAGE="$TOP/tests/test.img"
12 source "$TOP/tests/common"
22 # test rely on corrupting blocks tool
23 check_prereq btrfs-corrupt-block
24 check_prereq btrfs-image
32 echo " [TEST/fsck] $(basename $testname)"
34 echo "=== Entering $testname" >> "$RESULTS"
35 if [ -x test.sh ]; then
39 if [[ $TEST_LOG =~ dump ]]; then
42 _fail "test failed for case $(basename $testname)"
46 check_all_images `pwd`
51 # Each dir contains one type of error for btrfsck test.
52 # Each dir must be one of the following 2 types:
53 # 1) Only btrfs-image dump
54 # Only contains one or several btrfs-image dumps (.img)
55 # Each image will be tested by generic test routine
56 # (btrfsck --repair and btrfsck).
57 # This is for case that btree-healthy images.
58 # 2) Custom test script
59 # This dir contains test.sh which will do custom image
60 # generation/check/verification.
61 # This is for case btrfs-image can't dump or case needs extra
64 for i in $(find "$TOP/tests/fsck-tests" -maxdepth 1 -mindepth 1 -type d \
65 ${TEST:+-name "$TEST"} | sort)