Btrfs-progs: add feature to get mininum size for resizing a fs/device
[platform/upstream/btrfs-progs.git] / tests / misc-tests.sh
1 #!/bin/bash
2 #
3 # Misc tests
4
5 unset TOP
6 unset LANG
7 LANG=C
8 SCRIPT_DIR=$(dirname $(readlink -f $0))
9 TOP=$(readlink -f $SCRIPT_DIR/../)
10 TEST_DEV=${TEST_DEV:-}
11 TEST_MNT=${TEST_MNT:-$TOP/tests/mnt}
12 RESULTS="$TOP/tests/misc-tests-results.txt"
13 IMAGE="$TOP/tests/test.img"
14
15 source $TOP/tests/common
16
17 # Allow child test to use $TOP and $RESULTS
18 export TOP
19 export RESULTS
20 # For custom script needs to verfiy recovery
21 export TEST_MNT
22 export LANG
23 # For tests that only use a loop device
24 export IMAGE
25
26 rm -f $RESULTS
27 mkdir -p $TEST_MNT || _fail "unable to create mount point on $TEST_MNT"
28
29 # test rely on corrupting blocks tool
30 check_prereq btrfs-corrupt-block
31 check_prereq btrfs-image
32 check_prereq btrfstune
33 check_prereq btrfs
34
35 # The tests are driven by their custom script called 'test.sh'
36
37 for i in $(find $TOP/tests/misc-tests -maxdepth 1 -mindepth 1 -type d | sort)
38 do
39         echo "    [TEST]   $(basename $i)"
40         cd $i
41         echo "=== Entering $i" >> $RESULTS
42         if [ -x test.sh ]; then
43                 ./test.sh
44                 if [ $? -ne 0 ]; then
45                         _fail "test failed for case $(basename $i)"
46                 fi
47         fi
48         cd $TOP
49 done