[Piglit] [PATCH 1/2] framework/summary.py: add assert to Summary.__init__()

Dylan Baker baker.dylan.c at gmail.com
Wed Jan 22 07:46:55 PST 2014


Normally piglit doesn't generate test names with leading slashes, and
the code has no way to deal with them. In fact, a leading slash will
cause a loop in Summary.__init__ to run infinitely.  The simplest
solution is an assertion, which means the program will assert before it
ever gets to the loop.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/framework/summary.py b/framework/summary.py
index 6ee1226..2ba5f16 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -281,6 +281,12 @@ class Summary:
             status = self.status[results.name]
 
             for key, value in results.tests.iteritems():
+                # if the first character of key is a / then our while loop will
+                # become an infinite loop. Beyond that / should never be the
+                # leading character, if it is then there is a bug in one of the
+                # test profiles.
+                assert key[0] != '/'
+
                 #FIXME: Add subtest support
 
                 # Walk the test name as if it was a path, at each level update
-- 
1.8.5.3



More information about the Piglit mailing list