Skip to contentSkip to conversation

igt: Make "warn" status work again as expected.

PATCH Superseded Maarten Lankhorst 2 participants 3 messages Apr 19, 2016 – Apr 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igt: Make "warn" status work again as expected.

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.

---

tests/igt.py +3 -1
index 7ebb03646b50..1e5d2f111fa6 100644
@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#1 lore raw

Quoting Maarten Lankhorst (2016-04-19 06:33:36)

Quoted 12 lines

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.

---

tests/igt.py +0 -0
index 7ebb03646b50..1e5d2f111fa6 100644

tests/igt.py class IGTTest(Test): · line 117

Quoted 5 lines
tests/igt.py +1 -1
@@ -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.

tests/igt.py class IGTTest(Test): · line 122

Quoted 6 lines
tests/igt.py +2 -0
+            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,

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH v2 1/1 igt: Make "warn" status work again as expected, v2.

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.

[mlankhorst: Changed to not use len over a potentially large string in response to review comments.]

---
I don't have commit rights to piglit, so have a tested patch. :-)

 tests/igt.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/igt.py +4 -1
index 7ebb03646b50..132cfa0c8808 100644
@@ -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:
Signature · 7 lines
2.1.0


_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx