[Piglit] [PATCH] framework: fix comparing NOTRUN/SKIP to other statuses

Ilia Mirkin imirkin at alum.mit.edu
Sat Apr 5 07:31:46 PDT 2014


The current logic causes transitions involving notrun/skip to not show
up in problems. Remove the special handling of lt/gt/etc so that
max(status) can work, and reorder the logic that figures out which
category to select.

Cc: Chris Forbes <chrisf at ijw.co.nz>
Cc: Dylan Baker <baker.dylan.c at gmail.com>
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---

Chris reported this on IRC, and then I went back and noticed that I was
getting the error too, although I didn't notice.

Dylan, I'm not sure why you did things the way that you had it... but this
appears to work just fine.

 framework/status.py  | 12 ------------
 framework/summary.py | 16 ++++++----------
 2 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/framework/status.py b/framework/status.py
index bb7c594..d5e5f8e 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -195,12 +195,6 @@ class NoChangeStatus(Status):
     def __init__(self, name, value=0, fraction=(0, 0)):
         super(NoChangeStatus, self).__init__(name, value, fraction)
 
-    def __lt__(self, other):
-        return False
-
-    def __le__(self, other):
-        return False
-
     def __eq__(self, other):
         if isinstance(other, (str, unicode, Status)):
             return unicode(self) == unicode(other)
@@ -211,12 +205,6 @@ class NoChangeStatus(Status):
             return unicode(self) != unicode(other)
         raise TypeError("Cannot compare type: {}".format(type(other)))
 
-    def __ge__(self, other):
-        return False
-
-    def __gt__(self, other):
-        return False
-
 
 NOTRUN = NoChangeStatus('Not Run')
 
diff --git a/framework/summary.py b/framework/summary.py
index 6d2a7bb..eab0a4e 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -325,20 +325,16 @@ class Summary:
             for i in xrange(len(status) - 1):
                 first = status[i]
                 last = status[i + 1]
-                if first < last:
-                    self.tests['regressions'].add(test)
-                    self.tests['changes'].add(test)
-                    continue
-                elif first > last:
-                    self.tests['fixes'].add(test)
-                    self.tests['changes'].add(test)
-                    continue
-
                 if first in [so.SKIP, so.NOTRUN] and last not in [so.SKIP, so.NOTRUN]:
                     self.tests['enabled'].add(test)
-                    self.tests['changes'].add(test)
                 elif last in [so.SKIP, so.NOTRUN] and first not in [so.SKIP, so.NOTRUN]:
                     self.tests['disabled'].add(test)
+                elif first < last:
+                    self.tests['regressions'].add(test)
+                elif first > last:
+                    self.tests['fixes'].add(test)
+
+                if first != last:
                     self.tests['changes'].add(test)
 
     def __find_totals(self):
-- 
1.8.3.2



More information about the Piglit mailing list