- 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
+ if 'error' not in results[-1]:
+ match = os.path.join(decoders_dir, op['pd'], 'test', op['match'])
+ try:
+ diff = diff_error = None
+ if op['type'] in ('annotation', 'python'):
+ diff = diff_text(match, outfile)
+ elif op['type'] == 'binary':
+ diff = compare_binary(match, outfile)
+ else:
+ diff = ["Unsupported output type '%s'." % op['type']]
+ except Exception as e:
+ diff_error = e
+ if fix:
+ if diff or diff_error:
+ copy(outfile, match)
+ DBG("Wrote %s" % match)
+ else:
+ if diff:
+ results[-1]['diff'] = diff
+ elif diff_error is not None:
+ raise diff_error