Commit Graph

8 Commits

Author SHA1 Message Date
Stefan Berger
0da1dcc8a3 tests: Derive support for CUSE from SWTPM_EXE help screen
Use 'swtpm --help | grep cuse' to determine whether CUSE interface
is supported and CUSE related tests need to run. Make sure that
SWTPM_EXE is available when test_cuse is sourced.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-08-26 20:00:14 -04:00
Stefan Berger
b1b9a6a4ab tests: Add test cases for using swtpm --print-states while swtpm is running
swtpm <0.8 tried to lock the .lock file when executing --print-states,
which then failed when another swtpm was holding the lock. This adds
a test case for this scenario.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2024-06-11 08:43:01 -04:00
Stefan Berger
5704342aa8 tests: Fix shellcheck issue SC2181 by if cmd; ...
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-01-27 11:58:54 -05:00
Stefan Berger
fd7a812b24 tests: Fix code to pass shellcheck with some errors disabled
Fix the test cases to pass shellcheck with some of the errors
disable.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-01-13 13:59:02 -05:00
Stefan Berger
cce7503cbf tests: exit with error code if mktemp fails
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-11-02 08:35:49 -04:00
Stefan Berger
2fdb7c307b swtpm: Add size to each type of state and use JSON object
Add the size of the type state to the --print-states output and switch
back to a JSON object when enumerating the blobs.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-09-28 07:46:38 -04:00
Stefan Berger
f2aa3274b2 swtpm: Search for all state files and use abstracted names in JSON
Search for all the state files not just the permanent state and
when printing the JSON use the abstracted names rather than concrete
filenames that are only valid for the dir backend but will likely
not exist in other backends.

Adjust swtpm_setup to search for the abstracted name and also
adjust the error message to print out the abstracted name.

Adjust the test cases.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-09-25 10:26:07 -04:00
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