libtpms/tests/run-fuzzer.sh
Stefan Berger ba56737b93 tests: Wrap the fuzzer test in a script
Wrap the fuzzer test in a script to we can set up a per fuzzer
temporary directory where the NvChip file is written into.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2018-12-10 09:17:25 -05:00

35 lines
587 B
Bash
Executable File

#!/usr/bin/env bash
# For the license, see the LICENSE file in the root directory.
DIR=${PWD}/$(dirname "$0")
ROOT=${DIR}/..
WORKDIR=$(mktemp -d)
export LD_LIBRARY_PATH=${ROOT}/src/.libs
if ! [ -d ${LD_LIBRARY_PATH} ]; then
echo "Wrong path to libtpms library: ${LD_LIBRARY_PATH}"
exit 1
fi
if ! [ -f "$(readlink -f ${LD_LIBRARY_PATH}/libtpms.so)" ]; then
echo "Cannot find libtpms at ${LD_LIBRARY_PATH}/libtpms.so"
exit 1
fi
function cleanup()
{
rm -rf ${WORKDIR}
}
trap "cleanup" QUIT EXIT
pushd $WORKDIR
${DIR}/fuzz $@ ${DIR}/corpus-execute-command
rc=$?
popd
exit $rc