[Piglit] [PATCH 1/2] profile.py: pass options to the pre and post run hooks

Thomas Wood thomas.wood at intel.com
Thu Mar 26 08:43:16 PDT 2015


Signed-off-by: Thomas Wood <thomas.wood at intel.com>
---
 framework/profile.py | 12 ++++++++----
 tests/igt.py         |  2 +-
 tests/xts.py         |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index 603e872..1384bbd 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -168,21 +168,25 @@ class TestProfile(object):
                   file=sys.stderr)
             sys.exit(1)
 
-    def _pre_run_hook(self):
+    def _pre_run_hook(self, opts):
         """ Hook executed at the start of TestProfile.run
 
         To make use of this hook one will need to subclass TestProfile, and
         set this to do something, as be default it will no-op
 
+        Arguments:
+        opts -- a core.Options instance
         """
         pass
 
-    def _post_run_hook(self):
+    def _post_run_hook(self, opts):
         """ Hook executed at the end of TestProfile.run
 
         To make use of this hook one will need to subclass TestProfile, and
         set this to do something, as be default it will no-op
 
+        Arguments:
+        opts -- a core.Options instance
         """
         pass
 
@@ -205,7 +209,7 @@ class TestProfile(object):
 
         """
 
-        self._pre_run_hook()
+        self._pre_run_hook(opts)
         Test.OPTS = opts
 
         chunksize = 1
@@ -250,7 +254,7 @@ class TestProfile(object):
 
         log.get().summary()
 
-        self._post_run_hook()
+        self._post_run_hook(opts)
 
     def filter_tests(self, function):
         """Filter out tests that return false from the supplied function
diff --git a/tests/igt.py b/tests/igt.py
index 1bc7f23..8c7963b 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -91,7 +91,7 @@ else:
 
 class IGTTestProfile(TestProfile):
     """Test profile for intel-gpu-tools tests."""
-    def _pre_run_hook(self):
+    def _pre_run_hook(self, opts):
         if not check_environment():
             sys.exit(1)
 
diff --git a/tests/xts.py b/tests/xts.py
index 0e277dc..3ac931d 100644
--- a/tests/xts.py
+++ b/tests/xts.py
@@ -41,7 +41,7 @@ X_TEST_SUITE = framework.core.PIGLIT_CONFIG.get('xts', 'path')
 
 class XTSProfile(TestProfile):  # pylint: disable=too-few-public-methods
     """ A subclass of TestProfile that provides a setup hook for XTS """
-    def _pre_run_hook(self):
+    def _pre_run_hook(self, opts):
         """ This hook sets the XTSTest.results_path variable
 
         Setting this variable allows images created by XTS to moved into the
-- 
2.1.0



More information about the Piglit mailing list