swtpm/tests/test_print_states
Eiichi Tsukata 5bc59a74f3 swtpm: Add --print-states for reporting TPM states status
--print-states reports TPM states stored in --tpmstate backend.
This feature is supposed to be used by swtpm_setup for checking TPM state
existence.

Sample output is as follows:

  $ swtpm socket --print-states --tpmstate dir=/tmp --tpm2 | jq .
  {
    "type": "swtpm",
    "states": [
      {
        "name": "tpm2-00.permall"
      }
    ]
  }

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@nutanix.com>
2021-09-07 09:22:51 -04:00

21 lines
407 B
Bash
Executable File

#!/usr/bin/env bash
TESTDIR=${abs_top_testdir:-$(dirname "$0")}
ROOT=${abs_top_builddir:-$(dirname "$0")/..}
source ${TESTDIR}/common
skip_test_no_tpm12 "${SWTPM_EXE}"
cd "$(dirname "$0")"
export SWTPM_IFACE=cuse
bash _test_print_states
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
export SWTPM_IFACE=socket
bash _test_print_states
ret=$?
[ $ret -ne 0 ] && [ $ret -ne 77 ] && exit $ret
exit 0