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

Ilia Mirkin imirkin at alum.mit.edu
Sat Apr 5 09:00:41 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>
---

v1 -> v2:

 - revert accidental logic change wrt "changes" page; disabled tests shouldn't
   show up on it.

 framework/status.py  | 12 ------------
 framework/summary.py | 14 +++++---------
 2 files changed, 5 insertions(+), 21 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..a4aa136 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)
+                    self.tests['changes'].add(test)
+                elif first > last:
+                    self.tests['fixes'].add(test)
                     self.tests['changes'].add(test)
 
     def __find_totals(self):
-- 
1.8.3.2



More information about the Piglit mailing list