aboutsummaryrefslogtreecommitdiff
path: root/unit-tests.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2017-01-31 20:12:37 -0500
committerRob Austein <sra@hactrn.net>2017-01-31 20:12:37 -0500
commit9ec81408c25207149d8b3bfcfc80faf1c8ff0811 (patch)
treed6759e2deaeb5821c4fbebec3dfc661fa07f8241 /unit-tests.py
parent31ce1c88f745c2946b3c0eb9986e0aaed164485c (diff)
Enable low-level debugging support in libhal.py.
Diffstat (limited to 'unit-tests.py')
-rw-r--r--unit-tests.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/unit-tests.py b/unit-tests.py
index a8779c5..895bdb5 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -66,23 +66,19 @@ except ImportError:
ecdsa_loaded = False
-def log(msg):
- if not args.quiet:
- sys.stderr.write(msg)
- sys.stderr.write("\n")
-
-
def main():
from sys import argv
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)
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("--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")