summaryrefslogtreecommitdiffstats
path: root/tests/tpm2_pcr_read.sh
blob: f2dbe6e389192c13ca96cdc69a53e28006b06583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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_pcr_read
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