From f756ee8a281ddff7e09b49e1ef00d5cbb42abb63 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Mon, 17 Jun 2024 11:55:42 -0400 Subject: [PATCH] tests: Use regex to compare --print-states sizes output Older versions of libtpms produced smaller initial state files. Therefore, use a regular expression to compare the sizes. Signed-off-by: Stefan Berger --- tests/_test_tpm2_print_states | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/_test_tpm2_print_states b/tests/_test_tpm2_print_states index bb8dca875..eb68b678c 100755 --- a/tests/_test_tpm2_print_states +++ b/tests/_test_tpm2_print_states @@ -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}"