diff options
Diffstat (limited to 'test/tpm_test/tpmtest.py')
-rwxr-xr-x | test/tpm_test/tpmtest.py | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/test/tpm_test/tpmtest.py b/test/tpm_test/tpmtest.py index 823c3013e7..4a8e442265 100755 --- a/test/tpm_test/tpmtest.py +++ b/test/tpm_test/tpmtest.py @@ -7,6 +7,7 @@ from __future__ import print_function +import getopt import os import struct import sys @@ -26,6 +27,7 @@ import hash_test import hkdf_test import rsa_test import subcmd +import trng_test import upgrade_test # Extension command for dcypto testing @@ -130,12 +132,35 @@ class TPM(object): def debug_enabled(self): return self._debug_enabled +def usage(): + print ('Syntax: tpmtest.py [-d | -t | -h ]\n' + ' -d - prints additional debug information during tests\n' + ' -t - dump raw output from TRNG to /tmp/trng_output\n' + ' -h - this help\n') + return if __name__ == '__main__': try: - debug_needed = len(sys.argv) == 2 and sys.argv[1] == '-d' + opts, args = getopt.getopt(sys.argv[1:], 'dth','help') + except getopt.GetoptError as err: + print(str(err)) + usage() + sys.exit(2) + debug_needed = False + trng_only = False + for o, a in opts: + if o == '-d': + debug_needed = True + elif o == '-t': + trng_only = True + elif o == '-h' or o == '--help': + usage() + sys.exit(0) + try: t = TPM(debug_mode=debug_needed) - + if trng_only: + trng_test.trng_test(t) + sys.exit(1) crypto_test.crypto_tests(t, os.path.join(root_dir, 'crypto_test.xml')) ecc_test.ecc_test(t) ecies_test.ecies_test(t) |