All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH piglit] igt: Make "warn" status work again as expected.
@ 2016-04-19 13:33 Maarten Lankhorst
  2016-04-19 18:13 ` Dylan Baker
  0 siblings, 1 reply; 3+ messages in thread
From: Maarten Lankhorst @ 2016-04-19 13:33 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Dylan Baker

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@linux.intel.com>
Cc: Dylan Baker <baker.dylan.c@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:
+            self.result.result = 'warn'
+        elif self.result.returncode == 0:
             self.result.result = 'pass'
         elif self.result.returncode == 77:
             self.result.result = 'skip'

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH piglit] igt: Make "warn" status work again as expected.
  2016-04-19 13:33 [PATCH piglit] igt: Make "warn" status work again as expected Maarten Lankhorst
@ 2016-04-19 18:13 ` Dylan Baker
  2016-04-20 10:56   ` [PATCH v2 piglit] igt: Make "warn" status work again as expected, v2 Maarten Lankhorst
  0 siblings, 1 reply; 3+ messages in thread
From: Dylan Baker @ 2016-04-19 18:13 UTC (permalink / raw)
  To: Maarten Lankhorst, Intel Graphics Development


[-- Attachment #1.1: Type: text/plain, Size: 1578 bytes --]

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@linux.intel.com>
> Cc: Dylan Baker <baker.dylan.c@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@gmail.com>

[-- Attachment #1.2: signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAABCAAGBQJXFnVNAAoJEAieFpYUBojvo2IIAJJrptyZEFXn8ZMB0snvB7JI
Yy7UaR1iik8pAsNYh2SW19Q2iuVEA4tO1rvRK0Mfz+0tfxJ1AFZjMmkJ2DrOSEs2
egIXdRQ8UyKpYPlKbY4S1Q4NCBL2UxeafCRREHsyUtLsZNp/NsuVjz7wkrMV7+wf
pajuV4bCMJDBXVxz0Ftnk91avbFMFjNYu2R+U5ttxJJ5pMI1JE6IT/m+lYgyZp0F
hU3npiUZW5lW6cEkodMJkaCwBpQvCW2hUO2A4q7HESun8nZcNamlCPyXxX79fwDZ
8loZPTBbZXDixQZVvNQN/7h+msX22keSsZOWhwYqoHpcVhn2yMUAB8hmjqusXYw=
=3IYl
-----END PGP SIGNATURE-----

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 piglit] igt: Make "warn" status work again as expected, v2.
  2016-04-19 18:13 ` Dylan Baker
@ 2016-04-20 10:56   ` Maarten Lankhorst
  0 siblings, 0 replies; 3+ messages in thread
From: Maarten Lankhorst @ 2016-04-20 10:56 UTC (permalink / raw)
  To: Dylan Baker, Intel Graphics Development

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@linux.intel.com>
Cc: Dylan Baker <baker.dylan.c@gmail.com>
[mlankhorst: Changed to not use len over a potentially large string in
response to review comments.]
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
---
I don't have commit rights to piglit, so have a tested patch. :-)

 tests/igt.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/igt.py b/tests/igt.py
index 7ebb03646b50..132cfa0c8808 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -115,7 +115,10 @@ class IGTTest(Test):
         super(IGTTest, self).interpret_result()
 
         if self.result.returncode == 0:
-            self.result.result = 'pass'
+            if not self.result.err:
+                self.result.result = 'pass'
+            else:
+                self.result.result = 'warn'
         elif self.result.returncode == 77:
             self.result.result = 'skip'
         elif self.result.returncode == 78:
-- 
2.1.0


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-20 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-19 13:33 [PATCH piglit] igt: Make "warn" status work again as expected Maarten Lankhorst
2016-04-19 18:13 ` Dylan Baker
2016-04-20 10:56   ` [PATCH v2 piglit] igt: Make "warn" status work again as expected, v2 Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.