Dylan Baker <baker.dyla...@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.ja...@intel.com
> signed-off-by: Dylan Baker <dylanx.c.ba...@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
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to