libtpms/tests/fuzz.sh
Stefan Berger edd720a1ad tests: Restrict number of command line parameters to fuzz
Restrict the number of command line parameters passed to the
fuzz program in order not to overstep command line parameter
size restrictions.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-05-07 16:01:48 -04:00

20 lines
382 B
Bash
Executable File

#!/usr/bin/env bash
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
DIR=${PWD}
MAXLINES=128
l=1
corpus=$(ls "$TESTDIR/corpus-execute-command/"*)
while :; do
echo "Passing test cases $l to $((l + MAXLINES))"
tmp=$(echo "${corpus}" | sed -n "${l},$((l + MAXLINES))p")
[ -z "${tmp}" ] && exit 0
${DIR}/fuzz ${tmp}
rc=$?
[ $rc -ne 0 ] && exit $rc
l=$((l + MAXLINES))
done