Re: [PATCH piglit] igt: Make "warn" status work again as expected.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
> Cc: Dylan Baker <baker.dylan.c@xxxxxxxxx>
> ---
> 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@xxxxxxxxx>

Attachment: signature.asc
Description: signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux