btrfs-progs: docs: make option -A of mkfs less visible
[btrfs-progs-unstable/devel.git] / tests / fuzz-tests.sh
blobf72385e51fda94d79bf1d7a8721407e89ada935b
1 #!/bin/bash
3 # misc tests on fuzzed or crafted images
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/fuzz-tests-results.txt"
10 IMAGE="$TOP/tests/test.img"
12 source "$TOP/tests/common"
14 export TOP
15 export RESULTS
16 export LANG
17 export IMAGE
18 export TEST_DEV
20 rm -f "$RESULTS"
22 check_prereq btrfs
24 # The tests are driven by their custom script called 'test.sh'
26 for i in $(find "$TOP/tests/fuzz-tests" -maxdepth 1 -mindepth 1 -type d \
27 ${TEST:+-name "$TEST"} | sort)
29 name=$(basename "$i")
30 cd $i
31 if [ -x test.sh ]; then
32 echo "=== Entering $i" >> "$RESULTS"
33 echo " [TEST/fuzz] $name"
34 ./test.sh
35 if [ $? -ne 0 ]; then
36 if [[ $TEST_LOG =~ dump ]]; then
37 cat "$RESULTS"
39 _fail "test failed for case $(basename $i)"
42 cd "$TOP"
43 done