btrfs-progs: convert-test: trigger chunk allocation after convert
[platform/upstream/btrfs-progs.git] / tests / mkfs-tests.sh
1 #!/bin/bash
2 #
3 # mkfs.btrfs 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/mkfs-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 mkfs.btrfs
23 check_prereq btrfs
24 check_kernel_support
25
26 # The tests are driven by their custom script called 'test.sh'
27
28 for i in $(find "$TOP/tests/mkfs-tests" -maxdepth 1 -mindepth 1 -type d \
29         ${TEST:+-name "$TEST"} | sort)
30 do
31         echo "    [TEST/mkfs]   $(basename $i)"
32         cd "$i"
33         echo "=== Entering $i" >> "$RESULTS"
34         if [ -x test.sh ]; then
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