[Mesa-dev] [PATCH 4/4] glsl/tests/glcpp: reinstate "error out if no tests found"

Dylan Baker dylan at pnwbakers.com
Tue Apr 24 18:30:58 UTC 2018


Quoting Emil Velikov (2018-04-24 10:49:22)
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> With the recent rework of converting the shell script to a python one
> the check for actual tests was dropped.
> 
> Bring that back, since it was explicitly added considering we had a ~2
> year period, during which the tests were not run.
> 
> Fixes: db8cd8e36771 ("glcpp/tests: Convert shell scripts to a python
> script")
> Cc: Dylan Baker <dylan at pnwbakers.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> One might be interested in folding some of the duplication/boilerplate
> at a later stage. I'm trying to bring back the normal behaviour for now
> ;-)
> ---
>  src/compiler/glsl/glcpp/tests/glcpp_test.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/compiler/glsl/glcpp/tests/glcpp_test.py b/src/compiler/glsl/glcpp/tests/glcpp_test.py
> index 751bd40028..cb0f16f4e7 100644
> --- a/src/compiler/glsl/glcpp/tests/glcpp_test.py
> +++ b/src/compiler/glsl/glcpp/tests/glcpp_test.py
> @@ -118,6 +118,10 @@ def test_unix(args):
>              for l in diff:
>                  print(l, file=sys.stderr)
>  
> +    if not total:
> +        print ('Could not find any tests.')
> +        return False
> +

We don't use spaces between the functions and braces.

Just raise an exception here, not finding any tests is just catastrophic
failure.

    raise Exception('Could not find any tests.')

Dylan

>      print('{}/{}'.format(passed, total), 'tests returned correct results')
>      return total == passed
>  
> @@ -154,6 +158,10 @@ def _replace_test(args, replace):
>              for l in diff:
>                  print(l, file=sys.stderr)
>  
> +    if not total:
> +        print ('Could not find any tests.')
> +        return False
> +
>      print('{}/{}'.format(passed, total), 'tests returned correct results')
>      return total == passed
>  
> @@ -196,6 +204,10 @@ def test_valgrind(args):
>              print('FAIL')
>              print(log, file=sys.stderr)
>  
> +    if not total:
> +        print ('Could not find any tests.')
> +        return False
> +
>      print('{}/{}'.format(passed, total), 'tests returned correct results')
>      return total == passed
>  
> -- 
> 2.16.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180424/35b2f3ff/attachment.sig>


More information about the mesa-dev mailing list