tests/tpm2_key_protector_test: Reset "ret" on fail
Reset "ret" to 0 when a test case fails so that the other test cases could continue. Also set the exit status to 1 when encountering a failure to reflect the test result. Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
parent
b7d89e6671
commit
9f66a4719b
@ -285,12 +285,16 @@ srktests+=("ECC persistent no_fallback_srk")
|
||||
srktests+=("RSA transient fallback_srk")
|
||||
srktests+=("ECC transient fallback_srk")
|
||||
|
||||
exit_status=0
|
||||
|
||||
for i in "${!srktests[@]}"; do
|
||||
tpm2_seal_unseal ${srktests[$i]} || ret=$?
|
||||
if [ "${ret}" -eq 0 ]; then
|
||||
echo "TPM2 [${srktests[$i]}]: PASS"
|
||||
elif [ "${ret}" -eq 1 ]; then
|
||||
echo "TPM2 [${srktests[$i]}]: FAIL"
|
||||
ret=0
|
||||
exit_status=1
|
||||
else
|
||||
echo "Unexpected failure [${srktests[$i]}]" >&2
|
||||
exit ${ret}
|
||||
@ -303,9 +307,11 @@ if [ "${ret}" -eq 0 ]; then
|
||||
echo "TPM2 [NV Index]: PASS"
|
||||
elif [ "${ret}" -eq 1 ]; then
|
||||
echo "TPM2 [NV Index]: FAIL"
|
||||
ret=0
|
||||
exit_status=1
|
||||
else
|
||||
echo "Unexpected failure [NV index]" >&2
|
||||
exit ${ret}
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit ${exit_status}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user