pdtest: Handle unknown command line arguments.
[sigrok-test.git] / decoder / pdtest
index fa72934fc87e4197a7c7bd43d32ce2a701e600a6..25dfd83cb4a8bb85724b3b44cc92c4dd0f13c2da 100755 (executable)
@@ -383,6 +383,7 @@ def run_tests(tests, fix=False):
                         if re.match(reg, results[-1]['error']):
                             # found it, not an error
                             results[-1].pop('error')
+                            errors -= 1
                     if VERBOSE:
                         if 'diff' in results[-1]:
                             INFO("Output mismatch")
@@ -512,7 +513,10 @@ if len(sys.argv) == 1:
 
 opt_all = opt_run = opt_show = opt_list = opt_fix = opt_coverage = False
 report_dir = None
-opts, args = getopt(sys.argv[1:], "dvarslfcR:S:")
+try:
+    opts, args = getopt(sys.argv[1:], "dvarslfcR:S:")
+except Exception as e:
+    usage('error while parsing command line arguments: {}'.format(e))
 for opt, arg in opts:
     if opt == '-d':
         DEBUG += 1