Skip to content

Commit

Permalink
test_tpm2_dictionarylockout: cleanup tests
Browse files Browse the repository at this point in the history
Add an error handler and clean up testing output.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
  • Loading branch information
William Roberts committed Sep 27, 2017
1 parent 2a8ccbf commit 5f01218
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions test/system/test_tpm2_dictionarylockout.sh
Expand Up @@ -32,32 +32,25 @@
#;**********************************************************************;
###this script use for test the implementation tpm2_dictionarylockout

onerror() {
echo "$BASH_COMMAND on line ${BASH_LINENO[0]} failed: $?"
exit 1
}
trap onerror ERR

tpm2_dictionarylockout -s -n 5 -t 6 -l 7
if [ $? != 0 ];then
echo "tpm2_dictionarylockout command failed, please check the environment or parameters!"
exit 1
fi

if [ $(tpm2_dump_capability -c properties-variable | grep TPM_PT_MAX_AUTH_FAIL | sed -e 's/TPM_PT_MAX_AUTH_FAIL: \+//') != "0x00000005" ];then
echo "Failure: setting up the number of allowed tries in the lockout parameters"
exit 1
else
echo "Success: setting up the number of allowed tries in the lockout parameters"
fi

if [ $(tpm2_dump_capability -c properties-variable | grep TPM_PT_LOCKOUT_INTERVAL | sed -e 's/TPM_PT_LOCKOUT_INTERVAL: \+//') != "0x00000006" ];then
echo "Failure: setting up the lockout period in the lockout parameters"
exit 1
else
echo "Success: setting up the lockout period in the lockout parameters"
fi

if [ $(tpm2_dump_capability -c properties-variable | grep TPM_PT_LOCKOUT_RECOVERY | sed -e 's/TPM_PT_LOCKOUT_RECOVERY: \+//') != "0x00000007" ];then
echo "Failure: setting up the lockout recovery period in the lockout parameters"
exit 1
else
echo "Success: setting up the lockout recovery period in the lockout parameters"
fi

echo "passed tpm2_dictionarylockout tests"
exit 0

0 comments on commit 5f01218

Please sign in to comment.