[Piglit] [PATCH] tests/igt.py: don't run tests if the environment check failed

Dylan Baker baker.dylan.c at gmail.com
Tue Jan 27 12:32:30 PST 2015


Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>

On Tuesday, January 27, 2015 11:34:17 Thomas Wood wrote:
> Allow tests to be enumerated but not run if the environment check fails.
> This allows the piglit-print-commands utility to continue to work
> correctly, but prevents the tests from being run if the current
> environment will cause them to fail. This also helps prevent appending
> incorrect results to resumed test runs.
> 
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
>  tests/igt.py | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/igt.py b/tests/igt.py
> index e65b8a9..bd4c70e 100644
> --- a/tests/igt.py
> +++ b/tests/igt.py
> @@ -74,9 +74,14 @@ if not (os.path.exists(os.path.join(igtTestRoot, 'single-tests.txt'))
>      print "intel-gpu-tools test lists not found."
>      sys.exit(0)
>  
> -igtEnvironmentOk = checkEnvironment()
>  
> -profile = TestProfile()
> +class IGTTestProfile(TestProfile):
> +    """ Test profile for intel-gpu-tools tests. """
> +    def _pre_run_hook(self):
> +        if not checkEnvironment():
> +            sys.exit(1)
> +
> +profile = IGTTestProfile()
>  
>  class IGTTest(Test):
>      def __init__(self, binary, arguments=None):
> @@ -87,9 +92,6 @@ class IGTTest(Test):
>          self.timeout = 600
>  
>      def interpret_result(self):
> -        if not igtEnvironmentOk:
> -            return
> -
>          if self.result['returncode'] == 0:
>              self.result['result'] = 'pass'
>          elif self.result['returncode'] == 77:
> @@ -99,13 +101,6 @@ class IGTTest(Test):
>          else:
>              self.result['result'] = 'fail'
>  
> -    def run(self):
> -        if not igtEnvironmentOk:
> -            self.result['result'] = 'fail'
> -            self.result['info'] = unicode("Test Environment isn't OK")
> -            return
> -
> -        super(IGTTest, self).run()
>  
>  def listTests(listname):
>      with open(os.path.join(igtTestRoot, listname + '.txt'), 'r') as f:
> -- 
> 2.1.0
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150127/03694cc6/attachment.sig>


More information about the Piglit mailing list