mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-21 22:10:23 +00:00
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>
This commit is contained in:
parent
bc4aab3613
commit
ba56737b93
2
README
2
README
@ -88,7 +88,7 @@ Fuzz testing is known to work with Fedora 28 or later. It requires that the
|
||||
Ex:
|
||||
$ ./configure --with-openssl --with-tpm2 --enable-sanitizers --enable-fuzzer CC=clang
|
||||
$ make && make -C tests fuzz
|
||||
$ tests/fuzz tests/corpus-execute-command
|
||||
$ tests/run-fuzzer.sh
|
||||
|
||||
Maintainers
|
||||
-----------
|
||||
|
||||
34
tests/run-fuzzer.sh
Executable file
34
tests/run-fuzzer.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/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
|
||||
Loading…
Reference in New Issue
Block a user