- returncode = subprocess.call(retrace)
- if returncode:
- # TODO: allow other criterias here, such as, snapshot comparison or performance threshold
- bad()
+ p = subprocess.Popen(command, stdout=subprocess.PIPE)
+ stdout, stderr = p.communicate()
+ if p.returncode:
+ if not options.compare_prefix:
+ bad()
+ else:
+ skip()
+
+ if options.compare_prefix:
+ failed = False
+ precision_re = re.compile('^Snapshot (\S+) average precision of (\S+) bits$')
+ for line in stdout.split('\n'):
+ mo = precision_re.match(line)
+ if mo:
+ print line
+ call_no = int(mo.group(1))
+ precision = float(mo.group(2))
+ if precision < options.precision_threshold:
+ failed = True
+ if failed:
+ bad()
+
+ # TODO: allow more criterias here, such as, performance threshold