btrfs-progs: tests: check there are no unprintable characters in btrfs-image -ss...
[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 check_prereq btrfs-zero-log
28 check_prereq btrfs-find-root
29 check_prereq btrfs-select-super
30 check_kernel_support
31
32 # The tests are driven by their custom script called 'test.sh'
33
34 for i in $(find "$TOP/tests/misc-tests" -maxdepth 1 -mindepth 1 -type d \
35         ${TEST:+-name "$TEST"} | sort)
36 do
37         echo "    [TEST/misc]   $(basename $i)"
38         cd "$i"
39         echo "=== Entering $i" >> "$RESULTS"
40         if [ -x test.sh ]; then
41                 ./test.sh
42                 if [ $? -ne 0 ]; then
43                         if [[ $TEST_LOG =~ dump ]]; then
44                                 cat "$RESULTS"
45                         fi
46                         _fail "test failed for case $(basename $i)"
47                 fi
48         fi
49         cd "$TOP"
50 done