6 SCRIPT_DIR=$(dirname $(readlink -f "$0"))
8 TOP=$(readlink -f "$SCRIPT_DIR/../")
9 if [ -f "$TOP/configure.ac" ]; then
11 TEST_TOP="$TOP/tests/"
14 # external, defaults to system binaries
15 TOP=$(dirname `which btrfs`)
16 TEST_TOP="$SCRIPT_DIR"
17 INTERNAL_BIN="$TEST_TOP"
20 # assume external, TOP set from commandline
21 TEST_TOP="$SCRIPT_DIR"
22 INTERNAL_BIN="$TEST_TOP"
24 if ! [ -x "$TOP/btrfs" ]; then
25 echo "ERROR: cannot execute btrfs from TOP=$TOP"
28 TEST_DEV=${TEST_DEV:-}
29 RESULTS="$TEST_TOP/misc-tests-results.txt"
30 IMAGE="$TEST_TOP/test.img"
32 source "$TEST_TOP/common"
44 # test rely on corrupting blocks tool
45 check_prereq btrfs-corrupt-block
46 check_prereq btrfs-image
47 check_prereq btrfstune
49 check_prereq btrfs-find-root
50 check_prereq btrfs-select-super
53 # The tests are driven by their custom script called 'test.sh'
55 for i in $(find "$TEST_TOP/misc-tests" -maxdepth 1 -mindepth 1 -type d \
56 ${TEST:+-name "$TEST"} | sort)
58 echo " [TEST/misc] $(basename $i)"
60 echo "=== Entering $i" >> "$RESULTS"
61 if [ -x test.sh ]; then
64 if [[ $TEST_LOG =~ dump ]]; then
67 _fail "test failed for case $(basename $i)"