btrfs-progs: tests: add fuzzed image for invalid chunk sectorsize
[platform/upstream/btrfs-progs.git] / tests / misc-tests.sh
1 #!/bin/bash
2 #
3 # Misc tests
4
5 LANG=C
6 SCRIPT_DIR=$(dirname $(readlink -f $0))
7 TOP=$(readlink -f $SCRIPT_DIR/../)
8 TEST_DEV=${TEST_DEV:-}
9 RESULTS="$TOP/tests/misc-tests-results.txt"
10 IMAGE="$TOP/tests/test.img"
11
12 source $TOP/tests/common
13
14 export TOP
15 export RESULTS
16 export LANG
17 export TEST_DEV
18 export IMAGE
19
20 rm -f $RESULTS
21
22 # test rely on corrupting blocks tool
23 check_prereq btrfs-corrupt-block
24 check_prereq btrfs-image
25 check_prereq btrfstune
26 check_prereq btrfs
27
28 # The tests are driven by their custom script called 'test.sh'
29
30 for i in $(find $TOP/tests/misc-tests -maxdepth 1 -mindepth 1 -type d   \
31         ${TEST:+-name "$TEST"} | sort)
32 do
33         echo "    [TEST/misc]   $(basename $i)"
34         cd $i
35         echo "=== Entering $i" >> $RESULTS
36         if [ -x test.sh ]; then
37                 ./test.sh
38                 if [ $? -ne 0 ]; then
39                         _fail "test failed for case $(basename $i)"
40                 fi
41         fi
42         cd $TOP
43 done