3 # command line interface coverage tests
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/cli-tests-results.txt"
30 IMAGE="$TEST_TOP/test.img"
32 source "$TEST_TOP/common"
47 # The tests are driven by their custom script called 'test.sh'
49 for i in $(find "$TEST_TOP/cli-tests" -maxdepth 1 -mindepth 1 -type d \
50 ${TEST:+-name "$TEST"} | sort)
54 if [ -x test.sh ]; then
55 echo "=== Entering $i" >> "$RESULTS"
56 echo " [TEST/cli] $name"
59 if [[ $TEST_LOG =~ dump ]]; then
62 _fail "test failed for case $(basename $i)"