diff options
Diffstat (limited to '')
-rwxr-xr-x | tests/tpm2_selftest.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/tpm2_selftest.sh b/tests/tpm2_selftest.sh new file mode 100755 index 0000000..c06d765 --- /dev/null +++ b/tests/tpm2_selftest.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# For the license, see the LICENSE file in the root directory. + +ROOT=${abs_top_builddir:-$(pwd)/..} +TESTDIR=${abs_top_testdir:-$(dirname "$0")} +DIR=${PWD} + +WORKDIR=$(mktemp -d) + +. ${TESTDIR}/common + +function cleanup() +{ + rm -rf ${WORKDIR} +} + +trap "cleanup" QUIT EXIT + +pushd $WORKDIR &>/dev/null + +${DIR}/tpm2_selftest +rc=$? + +fs=$(get_filesize NVChip) +[ $? -ne 0 ] && exit 1 +if [ $fs -ne 176832 ]; then + echo "Error: Unexpected size of NVChip file." + echo "Expected: 131072" + echo "Got : $fs" + rc=1 +fi + +popd &>/dev/null + +exit $rc |