[Piglit] [PATCH 16/18] framework: refactor valgrind handling to make glean cleaner
Dylan Baker
baker.dylan.c at gmail.com
Fri Jul 11 11:32:36 PDT 2014
This allows more state in glean to be shared rather than storing the
same list in memory once for each glean test.
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
framework/exectest.py | 8 +++++---
framework/gleantest.py | 12 +++++++-----
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/framework/exectest.py b/framework/exectest.py
index ec8fdd4..25299c9 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -69,10 +69,13 @@ class Test(object):
run_concurrent -- If True the test is thread safe. Default: False
"""
- OPTS = Options()
__slots__ = ['run_concurrent', 'env', 'result', 'cwd', '_command',
'_test_hook_execute_run']
+ OPTS = Options()
+ _VALGRIND_CMD = ['valgrind', '--quiet', '--error-exitcode=1',
+ '--tool=memcheck']
+
def __init__(self, command, run_concurrent=False):
self._command = None
self.run_concurrent = run_concurrent
@@ -130,8 +133,7 @@ class Test(object):
def command(self):
assert self._command
if self.OPTS.valgrind:
- return ['valgrind', '--quiet', '--error-exitcode=1',
- '--tool=memcheck'] + self._command
+ return self._VALGRIND_CMD + self._command
return self._command
@command.setter
diff --git a/framework/gleantest.py b/framework/gleantest.py
index bc6f1d3..20d01fd 100644
--- a/framework/gleantest.py
+++ b/framework/gleantest.py
@@ -36,16 +36,18 @@ class GleanTest(Test):
"""
GLOBAL_PARAMS = []
- _EXECUTABLE = os.path.join(TEST_BIN_DIR, "glean")
+ _EXECUTABLE = [os.path.join(TEST_BIN_DIR, "glean"),
+ "-o", "-v", "-v", "-v", "-t"]
def __init__(self, name, **kwargs):
- super(GleanTest, self).__init__(
- [self._EXECUTABLE, "-o", "-v", "-v", "-v", "-t", "+" + name],
- **kwargs)
+ super(GleanTest, self).__init__(['+' + name], **kwargs)
@Test.command.getter
def command(self):
- return super(GleanTest, self).command + self.GLOBAL_PARAMS
+ if self.OPTS.valgrind:
+ return self._VALGRIND_CMD + self._EXECUTABLE + \
+ self._command + self.GLOBAL_PARAMS
+ return self._EXECUTABLE + self._command + self.GLOBAL_PARAMS
def interpret_result(self):
if self.result['returncode'] != 0 or 'FAIL' in self.result['out']:
--
2.0.0
More information about the Piglit
mailing list