summaryrefslogtreecommitdiff
path: root/decoder/pdtest
diff options
context:
space:
mode:
authorGerhard Sittig <gerhard.sittig@gmx.net>2017-01-25 21:09:20 +0100
committerGerhard Sittig <gerhard.sittig@gmx.net>2017-01-25 22:08:14 +0100
commit1a5417590cebb5f168079993778b608a131088a3 (patch)
tree57601b1a9df3a1ebbf2f12a7a2ed2dbce410b6e5 /decoder/pdtest
parenta1c10c43350cfbed4ac09d75b07158aac0944c46 (diff)
downloadsigrok-test-1a5417590cebb5f168079993778b608a131088a3.tar.gz
sigrok-test-1a5417590cebb5f168079993778b608a131088a3.zip
pdtest: Make exit code communicate the termination cause not counts
On one hand the exit(3) API might limit the range of values that can get communicated to callers (a single byte is used in some implementations). On the other hand wait(2) might interpret specific meaning into some of the returned values (abnormal cause of termination, like unhandled signals). So the use of error counts as exit codes for processes can be severely constrained. For specific non-zero values of error counts, an exit code of zero might be seen at the caller's side (modulo calculation or truncation). Don't pass error or difference counts to exit(3). Instead communicate the kind of termination (error or difference or success) in exit codes which reliably can get evaluated by callers.
Diffstat (limited to 'decoder/pdtest')
-rwxr-xr-xdecoder/pdtest6
1 files changed, 5 insertions, 1 deletions
diff --git a/decoder/pdtest b/decoder/pdtest
index 591ad1d..58b6eee 100755
--- a/decoder/pdtest
+++ b/decoder/pdtest
@@ -571,8 +571,12 @@ try:
ERR("Could not find sigrok-dumps repository at %s" % dumps_dir)
sys.exit(1)
results, errors = run_tests(testlist, fix=opt_fix)
+ ret = 0
errs, diffs = get_run_tests_error_diff_counts(results)
- ret = errs or diffs or 0
+ if errs:
+ ret = 1
+ elif diffs:
+ ret = 2
elif opt_show:
show_tests(testlist)
elif opt_list: