summaryrefslogtreecommitdiff
path: root/decoder/pdtest
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-01-25 20:57:39 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2017-01-25 22:06:38 +0100
commita1c10c43350cfbed4ac09d75b07158aac0944c46 (patch)
tree5c65febbbfa6459c99c1e0511fad29837565f049 /decoder/pdtest
parent4a918ee7137cf55461aa217c98b3a549ace28f98 (diff)
downloadsigrok-test-a1c10c43350cfbed4ac09d75b07158aac0944c46.tar.gz
sigrok-test-a1c10c43350cfbed4ac09d75b07158aac0944c46.zip
pdtest: Exit non-zero for errors as well as PD output differences
Make the pdtest(1) executable return a non-zero exit code for errors during test execution (as before) as well as for differences in the decoder output (that's the change). Return either the number of errors seen, or the number of tests which saw different output. Only return zero in the absence of errors and differences.
Diffstat (limited to 'decoder/pdtest')
-rwxr-xr-xdecoder/pdtest14
1 files changed, 13 insertions, 1 deletions
diff --git a/decoder/pdtest b/decoder/pdtest
index 897e3ef..591ad1d 100755
--- a/decoder/pdtest
+++ b/decoder/pdtest
@@ -436,6 +436,17 @@ def run_tests(tests, fix=False):
return results, errors
+def get_run_tests_error_diff_counts(results):
+ """Get error and diff counters from run_tests() results."""
+ errs = 0
+ diffs = 0
+ for result in results:
+ if 'error' in result:
+ errs += 1
+ if 'diff' in result:
+ diffs += 1
+ return errs, diffs
+
def gen_report(result):
out = []
@@ -560,7 +571,8 @@ try:
ERR("Could not find sigrok-dumps repository at %s" % dumps_dir)
sys.exit(1)
results, errors = run_tests(testlist, fix=opt_fix)
- ret = errors
+ errs, diffs = get_run_tests_error_diff_counts(results)
+ ret = errs or diffs or 0
elif opt_show:
show_tests(testlist)
elif opt_list: