btrfs-progs: convert-test: trigger chunk allocation after convert
[platform/upstream/btrfs-progs.git] / tests / cli-tests.sh
1 #!/bin/bash
2 #
3 # command line interface coverage 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/cli-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 IMAGE
18 export TEST_DEV
19
20 rm -f "$RESULTS"
21
22 check_prereq btrfs
23 check_kernel_support
24
25 # The tests are driven by their custom script called 'test.sh'
26
27 for i in $(find "$TOP/tests/cli-tests" -maxdepth 1 -mindepth 1 -type d  \
28         ${TEST:+-name "$TEST"} | sort)
29 do
30         name=$(basename "$i")
31         cd "$i"
32         if [ -x test.sh ]; then
33                 echo "=== Entering $i" >> "$RESULTS"
34                 echo "    [TEST/cli]   $name"
35                 ./test.sh
36                 if [ $? -ne 0 ]; then
37                         if [[ $TEST_LOG =~ dump ]]; then
38                                 cat "$RESULTS"
39                         fi
40                         _fail "test failed for case $(basename $i)"
41                 fi
42         fi
43         cd "$TOP"
44 done