[Piglit] [Patch v2 2/4] framework/core.py: Add pre_run and post_run hooks to TestProfile

Dylan Baker baker.dylan.c at gmail.com
Tue Apr 8 13:26:39 PDT 2014

On Tuesday, April 08, 2014 16:16:29 Tom Stellard wrote:
> On Tue, Apr 08, 2014 at 01:12:35PM -0700, Dylan Baker wrote:
> > These hooks no-op in the default TestProfile class, however they are
> > intended to give versatility and power to external test suites, which
> > may have specific environment requirements, setup requirements, or
> > teardown requirements, by allowing them to subclass TestProfile and 
> > these methods.
> Do you have an example of what these hooks could be used for?
> -Tom

It should be possible to run whatever code you wanted out of these hooks.
Here is the first (potential) consumer from XTS (patch 4):

class XTSProfile(TestProfile):
    """ A sublcass of TestProfile that provides a setup hook for XTS """
    def pre_run_hook(self):
        """ This hook sets the XTSTest.results_path variable

        Setting this variable allows images created by XTS to moved into the
        results directory

        XTSTest.RESULTS_PATH = self.results_dir

            os.mkdir(os.path.join(self.results_dir, 'images'))
        except OSError as e:
            # If the exception is not 'directory already exists', raise the
            # exception
            if e.errno != 17:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140408/c681ba1e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140408/c681ba1e/attachment.sig>

More information about the Piglit mailing list