[Piglit] [PATCH 1/9] tests/oglconform.py: wrap profile creation in a function
baker.dylan.c at gmail.com
baker.dylan.c at gmail.com
Wed Oct 21 11:06:26 PDT 2015
From: Dylan Baker <baker.dylan.c at gmail.com>
This makes generating the profile a cleaner affair, and enables testing
it. It also pulls variables out of the global scope that don't belong in
the global scope.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
tests/oglconform.py | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/tests/oglconform.py b/tests/oglconform.py
index cdae4d4..37a834e 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -36,7 +36,6 @@ if not os.path.exists(bin_oglconform):
raise exceptions.PiglitFatalError(
'Cannot find binary {}'.format(bin_oglconform))
-profile = TestProfile()
class OGLCTest(Test):
@@ -62,20 +61,26 @@ class OGLCTest(Test):
else:
self.result.result = 'fail'
-# Create a new top-level 'oglconform' category
-testlist_file = '/tmp/oglc.tests'
+def _make_profile():
+ profile = TestProfile()
+ testlist_file = '/tmp/oglc.tests'
-with open(os.devnull, "w") as devnull:
- subprocess.call([bin_oglconform, '-generateTestList', testlist_file],
- stdout=devnull.fileno(), stderr=devnull.fileno())
+ with open(os.devnull, "w") as devnull:
+ subprocess.call([bin_oglconform, '-generateTestList', testlist_file],
+ stdout=devnull.fileno(), stderr=devnull.fileno())
-with open(testlist_file) as f:
- testlist = f.read().splitlines()
- for l in testlist:
- try:
- category, test = l.split()
- profile.test_list[grouptools.join('oglconform', category, test)] \
- = OGLCTest(category, test)
- except:
- continue
+ with open(testlist_file) as f:
+ testlist = f.read().splitlines()
+ for l in testlist:
+ try:
+ category, test = l.split()
+ profile.test_list[grouptools.join('oglconform', category, test)] \
+ = OGLCTest(category, test)
+ except:
+ continue
+
+ return profile
+
+
+profile = _make_profile() # pylint: disable=invalid-name
--
2.6.1
More information about the Piglit
mailing list