Re: [Piglit] [PATCH] generated_tests: Actually catch exception in os.makedirs

2014-12-17 Thread Dylan Baker
You're right. Obviously I picked up a stray hunk from another branch.
I'll fix that and send a v2.

On Wednesday, December 17, 2014 03:28:43 PM Mark Janes wrote:
> It seems like you unintentionally included an extra file:
> generated_tests/genclbuiltins.py
> 
> The deltas are not related to os.makedirs.
> 
> Dylan Baker  writes:
> 
> >  generated_tests/genclbuiltins.py   | 54 
> > +-
> 
> > diff --git a/generated_tests/genclbuiltins.py 
> > b/generated_tests/genclbuiltins.py
> > index 7e85a51..681aa29 100644
> > --- a/generated_tests/genclbuiltins.py
> > +++ b/generated_tests/genclbuiltins.py
> > @@ -3,6 +3,8 @@ __all__ = ['gen', 'DATA_SIZES', 'MAX_VALUES', 'MAX', 'MIN', 
> > 'BMIN', 'BMAX',
> >  
> >  import os
> >  
> > +from modules import utils
> > +
> >  
> >  DATA_SIZES = {
> >  'char': 8,
> > @@ -139,44 +141,44 @@ def gen_kernel_1_arg(f, fnName, inType, outType):
> >  gen_kernel(f, fnName, [inType], outType, [vecSize], '')
> >  
> >  
> > -#  2 argument kernel with input types that match their vector size
> > -def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):
> > +#  2 argument kernel with input types that match
> > +def gen_kernel_2_arg_same_type(f, fnName, inType, outType):
> >  for vecSize in ALL_WIDTHS:
> > -gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> > +gen_kernel(f, fnName, [inType, inType], outType, [vecSize, 
> > vecSize],
> > '')


signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] generated_tests: Actually catch exception in os.makedirs

2014-12-17 Thread Mark Janes
It seems like you unintentionally included an extra file:
generated_tests/genclbuiltins.py

The deltas are not related to os.makedirs.

Dylan Baker  writes:

>  generated_tests/genclbuiltins.py   | 54 
> +-

> diff --git a/generated_tests/genclbuiltins.py 
> b/generated_tests/genclbuiltins.py
> index 7e85a51..681aa29 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -3,6 +3,8 @@ __all__ = ['gen', 'DATA_SIZES', 'MAX_VALUES', 'MAX', 'MIN', 
> 'BMIN', 'BMAX',
>  
>  import os
>  
> +from modules import utils
> +
>  
>  DATA_SIZES = {
>  'char': 8,
> @@ -139,44 +141,44 @@ def gen_kernel_1_arg(f, fnName, inType, outType):
>  gen_kernel(f, fnName, [inType], outType, [vecSize], '')
>  
>  
> -#  2 argument kernel with input types that match their vector size
> -def gen_kernel_2_arg_same_size(f, fnName, inTypes, outType):
> +#  2 argument kernel with input types that match
> +def gen_kernel_2_arg_same_type(f, fnName, inType, outType):
>  for vecSize in ALL_WIDTHS:
> -gen_kernel(f, fnName, inTypes, outType, [vecSize, vecSize],
> +gen_kernel(f, fnName, [inType, inType], outType, [vecSize, vecSize],
> '')
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] generated_tests: Actually catch exception in os.makedirs

2014-12-17 Thread Dylan Baker
Patch b59ff71eb was supposed to fix os.makedirs exceptions, but falls
short because of a missing else statement that causes all of the caught
exceptions to fall back to raise.

This corrects, it also pulls the duplicate functions out into a shared
module.

Signed-off-by: Dylan Baker 
---
 generated_tests/gen_builtin_packing_tests.py   |  9 +---
 generated_tests/gen_builtin_uniform_tests.py   | 12 ++---
 generated_tests/gen_builtin_uniform_tests_fp64.py  | 12 ++---
 generated_tests/gen_const_builtin_equal_tests.py   |  9 +---
 generated_tests/gen_constant_array_size_tests.py   | 11 +
 .../gen_constant_array_size_tests_fp64.py  | 11 +
 generated_tests/gen_interpolation_tests.py | 11 +
 generated_tests/gen_non-lvalue_tests.py|  4 +-
 generated_tests/gen_outerproduct_invalid_params.py |  9 +---
 generated_tests/gen_outerproduct_tests.py  | 10 ++--
 generated_tests/gen_shader_bit_encoding_tests.py   |  9 +---
 .../gen_shader_image_load_store_tests.py   | 10 ++--
 generated_tests/gen_texture_lod_tests.py   |  9 +---
 generated_tests/gen_texture_query_lod_tests.py |  9 +---
 generated_tests/gen_uniform_initializer_tests.py   | 12 ++---
 generated_tests/genclbuiltins.py   | 54 +-
 generated_tests/generate-cl-store-tests.py | 10 ++--
 .../interpolation-qualifier-built-in-variable.py   |  9 +---
 {tests => generated_tests/modules}/__init__.py |  0
 generated_tests/modules/utils.py   | 43 +
 20 files changed, 105 insertions(+), 158 deletions(-)
 copy {tests => generated_tests/modules}/__init__.py (100%)
 create mode 100644 generated_tests/modules/utils.py

diff --git a/generated_tests/gen_builtin_packing_tests.py 
b/generated_tests/gen_builtin_packing_tests.py
index 5ca727a..901f493 100644
--- a/generated_tests/gen_builtin_packing_tests.py
+++ b/generated_tests/gen_builtin_packing_tests.py
@@ -43,6 +43,7 @@ from math import copysign, fabs, fmod, frexp, isinf, isnan, 
modf
 from numpy import int8, int16, uint8, uint16, uint32, float32
 
 from templates import template_dir
+from modules import utils
 
 TEMPLATES = template_dir(os.path.basename(os.path.splitext(__file__)[0]))
 
@@ -1027,13 +1028,7 @@ class ShaderTest(object):
 
 def write_file(self):
 dirname = os.path.dirname(self.filename)
-if not os.path.exists(dirname):
-try:
-os.makedirs(dirname)
-except OSError as e:
-if e.errno == 17:  # file exists
-pass
-raise
+utils.safe_makedirs(dirname)
 
 with open(self.filename, "w") as f:
 f.write(self.__template.render(func=self.__func_info))
diff --git a/generated_tests/gen_builtin_uniform_tests.py 
b/generated_tests/gen_builtin_uniform_tests.py
index d3a7816..9bb3075 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -52,6 +52,8 @@ import os
 import os.path
 import sys
 
+from modules import utils
+
 
 def compute_offset_and_scale(test_vectors):
 """Compute scale and offset values such that for each result in
@@ -537,15 +539,7 @@ class ShaderTest(object):
 shader_test += self.make_test()
 filename = self.filename()
 dirname = os.path.dirname(filename)
-
-if not os.path.exists(dirname):
-try:
-os.makedirs(dirname)
-except OSError as e:
-if e.errno == 17:  # file exists
-pass
-raise
-
+utils.safe_makedirs(dirname)
 with open(filename, 'w') as f:
 f.write(shader_test)
 
diff --git a/generated_tests/gen_builtin_uniform_tests_fp64.py 
b/generated_tests/gen_builtin_uniform_tests_fp64.py
index cf10c85..23032bd 100644
--- a/generated_tests/gen_builtin_uniform_tests_fp64.py
+++ b/generated_tests/gen_builtin_uniform_tests_fp64.py
@@ -52,6 +52,8 @@ import os
 import os.path
 import sys
 
+from modules import utils
+
 
 def compute_offset_and_scale(test_vectors):
 """Compute scale and offset values such that for each result in
@@ -507,15 +509,7 @@ class ShaderTest(object):
 shader_test += self.make_test()
 filename = self.filename()
 dirname = os.path.dirname(filename)
-
-if not os.path.exists(dirname):
-try:
-os.makedirs(dirname)
-except OSError as e:
-if e.errno == 17:  # file exists
-pass
-raise
-
+utils.safe_makedirs(dirname)
 with open(filename, 'w') as f:
 f.write(shader_test)
 
diff --git a/generated_tests/gen_const_builtin_equal_tests.py 
b/generated_tests/gen_const_builtin_equal_tests.py
index 490a591..47a238c 100644
--- a/generated_tests/gen_const_builtin_equal_tests.py
+++ b/generated_tests/gen_const_builtin_equal_tests.py
@@ -25,6 +25,7 @@ import re
 import os