summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBert Vermeulen <bert@biot.com>2013-12-11 12:49:30 +0100
committerBert Vermeulen <bert@biot.com>2013-12-11 12:49:30 +0100
commit2c53ea9310728f451a7c69c49d376b727ff08ff3 (patch)
treea946a81c02658d92f93a3e96ab3883806f217b80 /tests
parentc87dce4c93822df764cc380213e9a69eced7e6e9 (diff)
downloadlibsigrokdecode-2c53ea9310728f451a7c69c49d376b727ff08ff3.tar.gz
libsigrokdecode-2c53ea9310728f451a7c69c49d376b727ff08ff3.zip
pdtest: Don't bother with diff if any error at all occurred.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/pdtest19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/pdtest b/tests/pdtest
index 45fb342..ac51165 100755
--- a/tests/pdtest
+++ b/tests/pdtest
@@ -244,17 +244,24 @@ def run_tests(tests):
fd, outfile = mkstemp()
os.close(fd)
opargs.extend(['-f', outfile])
- DBG("Running %s %s" % (cmd, ' '.join(args + opargs)))
- stdout, stderr = Popen(args + opargs, stdout=PIPE, stderr=PIPE).communicate()
+ DBG("Running %s" % (' '.join(args + opargs)))
+ p = Popen(args + opargs, stdout=PIPE, stderr=PIPE)
+ stdout, stderr = p.communicate()
if stdout:
results[-1]['statistics'] = stdout.decode('utf-8').strip()
if stderr:
results[-1]['error'] = stderr.decode('utf-8').strip()
errors += 1
- match = "%s/%s/test/%s" % (decoders_dir, op['pd'], op['match'])
- diff = diff_files(match, outfile)
- if diff:
- results[-1]['diff'] = diff
+ elif p.returncode != 0:
+ # runtc indicated an error, but didn't output a
+ # message on stderr about it
+ results[-1]['error'] = "Unknown error: runtc %d" % p.returncode
+ # Only bother with the diff if it all worked.
+ if 'error' not in results[-1]:
+ match = "%s/%s/test/%s" % (decoders_dir, op['pd'], op['match'])
+ diff = diff_files(match, outfile)
+ if diff:
+ results[-1]['diff'] = diff
except Exception as e:
results[-1]['error'] = str(e)
finally: