[Piglit] [PATCH] framework: Add handler for failure and error when expecting the other
Dylan Baker
baker.dylan.c at gmail.com
Wed Mar 16 16:22:59 UTC 2016
Quoting Mark Janes (2016-03-15 17:40:16)
> Dylan Baker <baker.dylan.c at gmail.com> writes:
>
> > Right now the JUnit backend knows what to do with a failure when it
> > expects one (or a crash), but not what to do when it expects a failure
> > and gets a crash (or vice versa).
> >
> > This patch teaches it what to do in that case, mark the test as a
> > failure and give a message explaining why.
> >
> > cc: mark.a.janes at intel.com
> > signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> > ---
> > framework/backends/junit.py | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/framework/backends/junit.py b/framework/backends/junit.py
> > index f9eec66..761b201 100644
> > --- a/framework/backends/junit.py
> > +++ b/framework/backends/junit.py
> > @@ -151,6 +151,12 @@ class JUnitBackend(FileBackend):
> > err.text += "\n\nWARN: passing test as an expected failure"
> > res = etree.SubElement(element, 'skipped',
> > message='expected failure')
> > + elif expected_result == 'error':
> > + err.text += \
> > + "\n\nERROR: Test should have been crash but was failure"
> > + res = etree.SubElement(element, 'failure',
> > + message='expected crash, but got '
> > + 'failure')
> > else:
> > res = etree.SubElement(element, 'failure')
> >
> > @@ -159,6 +165,12 @@ class JUnitBackend(FileBackend):
> > err.text += "\n\nWARN: passing test as an expected crash"
> > res = etree.SubElement(element, 'skipped',
> > message='expected crash')
> > + elif expected_result == 'failure':
> > + err.text += \
> > + "\n\nERROR: Test should have been failure but was crash"
> > + res = etree.SubElement(element, 'failure',
> I think you want to insert an 'error' tag here ^^^^^^^
> > + message='expected failure, but got '
> > + 'crash')
> > else:
> > res = etree.SubElement(element, 'error')
> >
> > --
> > 2.7.3
After discussing this offline, you are right.
I've made the change locally, do you want to see a v2?
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20160316/dc0643a4/attachment.sig>
More information about the Piglit
mailing list