The match value should be the name of the exception thrown, e.g.
AttributeError, IndexError or even a custom exception defined in
the protocol decoder, such as SamplerateError.
from getopt import getopt
from tempfile import mkstemp
from subprocess import Popen, PIPE
from getopt import getopt
from tempfile import mkstemp
from subprocess import Popen, PIPE
if coverage:
results[-1]['coverage_report'] = coverage
os.unlink(outfile)
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")
if VERBOSE:
if 'diff' in results[-1]:
INFO("Output mismatch")
op->type = SRD_OUTPUT_BINARY;
else if (!strcmp(opstr[1], "python"))
op->type = SRD_OUTPUT_PYTHON;
op->type = SRD_OUTPUT_BINARY;
else if (!strcmp(opstr[1], "python"))
op->type = SRD_OUTPUT_PYTHON;
+ else if (!strcmp(opstr[1], "exception"))
+ /* Doesn't matter, we just need it to bomb out. */
+ op->type = SRD_OUTPUT_PYTHON;
else {
ERR("Unknown output type '%s'", opstr[1]);
g_strfreev(opstr);
else {
ERR("Unknown output type '%s'", opstr[1]);
g_strfreev(opstr);