[Piglit] [PATCH 4/4] tests/quick_shader.py: Fix test count of quick_shader

Dylan Baker dylan at pnwbakers.com
Tue May 8 21:22:07 UTC 2018


This filter hasn't worked quite right since the XML profile conversion,
the reason is that the assumption all filters had before the conversion
was that they would be used once, which is no longer true. They'll be
run at least twice now, once to get the count of tests, and once to
run the tests.

With the addition of the reset() method to the filter protocol, and the
Filter class that calls it, we can set the seed in the random generator
back to 42 (an arbitrary starting value), before it's run. This ensures
that the generation of the count and running of the actual tests match.
---
 tests/quick_shader.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/quick_shader.py b/tests/quick_shader.py
index c1b1d7938..f1bda6545 100644
--- a/tests/quick_shader.py
+++ b/tests/quick_shader.py
@@ -46,6 +46,9 @@ class FilterVsIn(object):
             return self.random.random() <= .2
         return True
 
+    def reset(self):
+        self.random.seed(42)
+
 
 profile.filters.append(FilterVsIn())
 
-- 
2.17.0



More information about the Piglit mailing list