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
set
> > 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

        try:
            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:
                raise

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to