summaryrefslogtreecommitdiffstats
path: root/tests/tpm2_pcr_read.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:41:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:41:43 +0000
commit92cccad89d1c12b39165d5f0ed7ccd2d44965a1a (patch)
treef59a2764cd8c50959050a428bd8fc935138df750 /tests/tpm2_pcr_read.sh
parentInitial commit. (diff)
downloadlibtpms-92cccad89d1c12b39165d5f0ed7ccd2d44965a1a.tar.xz
libtpms-92cccad89d1c12b39165d5f0ed7ccd2d44965a1a.zip
Adding upstream version 0.9.2.upstream/0.9.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/tpm2_pcr_read.sh')
-rwxr-xr-xtests/tpm2_pcr_read.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/tpm2_pcr_read.sh b/tests/tpm2_pcr_read.sh
new file mode 100755
index 0000000..f2dbe6e
--- /dev/null
+++ b/tests/tpm2_pcr_read.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_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