aboutsummaryrefslogtreecommitdiff
path: root/unit-tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests.py')
-rw-r--r--unit-tests.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/unit-tests.py b/unit-tests.py
index c1d0d44..bc7edf7 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -75,14 +75,20 @@ def main():
global args
args = parse_arguments(argv[1:])
argv = argv[:1] + args.only_test
- logging.basicConfig(level = logging.DEBUG if args.debug else logging.INFO)
- unittest.main(verbosity = 1 if args.quiet else 2, argv = argv, catchbreak = True, testRunner = TextTestRunner)
+ logging.basicConfig(level = logging.DEBUG if args.debug else logging.INFO,
+ datefmt = "%Y-%m-%d %H:%M:%S",
+ format = "%(asctime)-15s %(name)s[%(process)d]:%(levelname)s: %(message)s",)
+ unittest.main(verbosity = 1 if args.quiet else 2,
+ argv = argv,
+ catchbreak = True,
+ testRunner = TextTestRunner)
def parse_arguments(argv = ()):
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
parser = ArgumentParser(description = __doc__, formatter_class = ArgumentDefaultsHelpFormatter)
parser.add_argument("--quiet", action = "store_true", help = "suppress chatter")
parser.add_argument("--debug", action = "store_true", help = "debug-level logging")
+ parser.add_argument("--io-log", action = "store_true", help = "log HSM I/O stream")
parser.add_argument("--wheel-pin", default = "fnord", help = "PIN for wheel user")
parser.add_argument("--so-pin", default = "fnord", help = "PIN for security officer")
parser.add_argument("--user-pin", default = "fnord", help = "PIN for normal user")
@@ -99,6 +105,7 @@ pin_map = { HAL_USER_NORMAL : "user_pin", HAL_USER_SO : "so_pin", HAL_USER_WHEEL
def setUpModule():
global hsm
hsm = HSM()
+ hsm.debug_io = args.io_log
def tearDownModule():
hsm.logout()