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

2018-04-24 Thread Dylan Baker
Quoting Emil Velikov (2018-04-24 10:49:22)
> From: Emil Velikov 
> 
> 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 
> Signed-off-by: Emil Velikov 
> ---
> 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
> 


signature.asc
Description: signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2018-04-24 Thread Emil Velikov
From: Emil Velikov 

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 
Signed-off-by: Emil Velikov 
---
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
+
 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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev