summaryrefslogtreecommitdiff
path: root/tests/fuzz-tests.sh
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2016-07-26 13:24:39 +0100
committerDimitri John Ledkov <xnox@ubuntu.com>2016-07-26 13:24:39 +0100
commit3d69435ee3292b4b1db2d61c4784789d75883821 (patch)
tree2c0edc9d9501374799875af36259089feb99d48c /tests/fuzz-tests.sh
Imported Upstream version 4.6.1
Diffstat (limited to 'tests/fuzz-tests.sh')
-rwxr-xr-xtests/fuzz-tests.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/fuzz-tests.sh b/tests/fuzz-tests.sh
new file mode 100755
index 00000000..29691cae
--- /dev/null
+++ b/tests/fuzz-tests.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# misc tests on fuzzed or crafted images
+
+LANG=C
+SCRIPT_DIR=$(dirname $(readlink -f $0))
+TOP=$(readlink -f $SCRIPT_DIR/../)
+TEST_DEV=${TEST_DEV:-}
+RESULTS="$TOP/tests/fuzz-tests-results.txt"
+IMAGE="$TOP/tests/test.img"
+
+source $TOP/tests/common
+
+export TOP
+export RESULTS
+export LANG
+export IMAGE
+export TEST_DEV
+
+rm -f $RESULTS
+
+check_prereq btrfs
+
+# The tests are driven by their custom script called 'test.sh'
+
+for i in $(find $TOP/tests/fuzz-tests -maxdepth 1 -mindepth 1 -type d \
+ ${TEST:+-name "$TEST"} | sort)
+do
+ name=$(basename $i)
+ cd $i
+ if [ -x test.sh ]; then
+ echo "=== Entering $i" >> $RESULTS
+ echo " [TEST/fuzz] $name"
+ ./test.sh
+ if [ $? -ne 0 ]; then
+ _fail "test failed for case $(basename $i)"
+ fi
+ fi
+ cd $TOP
+done