1#!/bin/sh
2
3TESTRUNNER="$(pwd)/../cmd2yaml"
4
5testfile="${TMPDIR:-/tmp}/libmpdserver-fuzzing"
6trap "rm -f '${testfile}' 2>/dev/null" INT EXIT
7
8while true; do
9 find . -name input -a -type f -exec radamsa {} \+ |
10 tee "${testfile}" | valgrind --error-exitcode=1 \
11 --leak-check=full "${TESTRUNNER}" >/dev/null 2>&1
12
13 ret=$?
14 if [ ${ret} -ne 0 -a ${ret} -ne 1 ]; then
15 echo "Found input causing crash or leak:" 2>&1
16 cat "${testfile}" 2>&1
17 exit 1
18 fi
19done