3 # misc tests on fuzzed or crafted images
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/fuzz-tests-results.txt"
30 IMAGE="$TEST_TOP/test.img"
32 source "$TEST_TOP/common"
46 # The tests are driven by their custom script called 'test.sh'
48 for i in $(find "$TEST_TOP/fuzz-tests" -maxdepth 1 -mindepth 1 -type d \
49 ${TEST:+-name "$TEST"} | sort)
53 if [ -x test.sh ]; then
54 echo "=== Entering $i" >> "$RESULTS"
55 echo " [TEST/fuzz] $name"
58 if [[ $TEST_LOG =~ dump ]]; then
61 _fail "test failed for case $(basename $i)"