X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=tests%2Fpdtest;h=9309fb9dfc066c578715cd9ebbf171858dc147c0;hb=d45058e87e7045fef1b7c4425de1917a554545f7;hp=57a8b54caf0d73957ef45463e7a2cd49c275ca6e;hpb=6a15597a7b3f901b566b7bfc8c484a14e0fb6a11;p=libsigrokdecode.git diff --git a/tests/pdtest b/tests/pdtest index 57a8b54..9309fb9 100755 --- a/tests/pdtest +++ b/tests/pdtest @@ -20,6 +20,7 @@ import os import sys +import re from getopt import getopt from tempfile import mkstemp from subprocess import Popen, PIPE @@ -376,6 +377,12 @@ def run_tests(tests, fix=False): if coverage: results[-1]['coverage_report'] = coverage os.unlink(outfile) + if op['type'] == 'exception' and 'error' in results[-1]: + # filter out the exception we were looking for + reg = "^Error: srd: Protocol decoder instance %s: %s:" % (op['pd'], op['match']) + if re.match(reg, results[-1]['error']): + # found it, not an error + results[-1].pop('error') if VERBOSE: if 'diff' in results[-1]: INFO("Output mismatch") @@ -410,6 +417,21 @@ def run_tests(tests, fix=False): if VERBOSE: dots = '.' * (54 - len(pd) - 2) INFO("%s total %s %d%%" % (pd, dots, pd_coverage)) + if report_dir: + # generate a missing lines list across all the files in + # the PD + files = {} + for entry in missed_lines: + filename, line = entry.split(':') + if filename not in files: + files[filename] = [] + files[filename].append(line) + text = '' + for filename in sorted(files.keys()): + line_list = ','.join(sorted(files[filename], key=int)) + text += "%s: %s\n" % (filename, line_list) + open(os.path.join(report_dir, pd + "_total"), 'w').write(text) + return results, errors