[Piglit] [PATCH 5/8] framework: Refactor a bit, reducing required cleverness.

Eric Anholt eric at anholt.net
Wed Sep 18 15:00:30 PDT 2013


Now that the pages-list "optimization" is gone, we can move the
changes list computation into an obvious place, avoiding any work in
the single-results-file case.
---
 framework/summary.py | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 8f6f5f7..be9c96e 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -432,13 +432,6 @@ class Summary:
                 status_text.append(s)
                 status.append(find_regressions(s))
 
-            # Check and append self.tests['changes']
-            # A set cannot contain duplicate entries, so creating a set
-            # out the list will reduce it's length to 1 if all entries
-            # are the same, meaning it is not a change
-            if len(set(status)) > 1:
-                self.tests['changes'].add(test)
-
             for i in status_text:
                 if i not in ['pass', 'skip', 'special']:
                     self.tests['problems'].add(test)
@@ -446,13 +439,13 @@ class Summary:
             if 'skip' in status_text:
                 self.tests['skipped'].add(test)
 
-            # Find both fixes and regressions, and append them to the
-            # proper lists
             for i in xrange(len(status) - 1):
-                if status[i] < status[i + 1] and status[i] != 0:
-                    self.tests['regressions'].add(test)
-                if status[i] > 1 and status[i + 1] == 1:
-                    self.tests['fixes'].add(test)
+                if status[i] != status[i + 1]:
+                    self.tests['changes'].add(test)
+                    if status[i] < status[i + 1] and status[i] != 0:
+                        self.tests['regressions'].add(test)
+                    if status[i] > 1 and status[i + 1] == 1:
+                        self.tests['fixes'].add(test)
 
     def __find_totals(self):
         """
-- 
1.8.4.rc3



More information about the Piglit mailing list