[Intel-gfx] [PATCH piglit] igt: Make "warn" status work again as expected.

Dylan Baker baker.dylan.c at gmail.com
Tue Apr 19 18:13:33 UTC 2016


Quoting Maarten Lankhorst (2016-04-19 06:33:36)
> When writing a patch that adds a igt_warn() when lockdep is unavailable
> I noticed that the warn error doesn't work any more. Fix this by monitoring
> stderr, and only setting 'pass' when stderr is empty.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Dylan Baker <baker.dylan.c at gmail.com>
> ---
> diff --git a/tests/igt.py b/tests/igt.py
> index 7ebb03646b50..1e5d2f111fa6 100644
> --- a/tests/igt.py
> +++ b/tests/igt.py
> @@ -114,7 +114,9 @@ class IGTTest(Test):
>      def interpret_result(self):
>          super(IGTTest, self).interpret_result()
>  
> -        if self.result.returncode == 0:
> +        if self.result.returncode == 0 and len(self.result.err) > 0:

I think this would be cleaner as:
if self.result.returncode == 0:
    if self.result.err:
        self.result.result = 'warn'
    else:
        self.result.result = 'pass'

Since that avoids checking the returncode twice, and avoids calling len
on a possibly quite large string.

Note that in python an empty string, False, None, 0, an empty container
(dict, list, set, etc) will automatically fail an if statement, without
having to additionally call len() on the item.

> +            self.result.result = 'warn'
> +        elif self.result.returncode == 0:
>              self.result.result = 'pass'
>          elif self.result.returncode == 77:
>              self.result.result = 'skip'
> 

With that change you have my rb,
Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>
-------------- 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/intel-gfx/attachments/20160419/d832f50b/attachment.sig>


More information about the Intel-gfx mailing list