Skip to content

Commit

Permalink
tests: Use regex to compare --print-states sizes output
Browse files Browse the repository at this point in the history
Older versions of libtpms produced smaller initial state files.
Therefore, use a regular expression to compare the sizes.

Signed-off-by: Stefan Berger <[email protected]>
  • Loading branch information
stefanberger committed Jun 17, 2024
1 parent 76b58d7 commit f756ee8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/_test_tpm2_print_states
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ if [ "${SWTPM_IFACE}" = socket ]; then
exit 1
fi

exp='\{ "type": "swtpm", "states": \[ \{"name": "permall", "size": 1315\} \] \}'
# sizes: libtpms v0.7: 1181 ; >= v0.8: 1315
exp='^\{ "type": "swtpm", "states": \[ \{"name": "permall", "size": 1[0-9]{3}\} \] \}$'
if ! [[ ${msg} =~ ${exp} ]]; then
echo "Unexpected response from ${SWTPM_IFACE} TPM to --print-states:"
echo "Actual : ${msg}"
Expand Down

0 comments on commit f756ee8

Please sign in to comment.