diff options
author | Dylan Baker <dylanx.c.baker@intel.com> | 2014-12-11 15:32:46 -0800 |
---|---|---|
committer | Dylan Baker <dylanx.c.baker@intel.com> | 2014-12-12 16:29:58 -0800 |
commit | b59ff71eb37b3ee01e5a34dda1a7ccbd4ba936f0 (patch) | |
tree | 499bf522297b5a7d83879e41303cca448402a3a0 /generated_tests/gen_texture_query_lod_tests.py | |
parent | c1cf7865e742666ba46197827af1a854215cbd17 (diff) |
generated_tests: Except error for os.makedirs
Currently we check for the existence of a directory, and if it doesn't
exist we create it. This would be fine, except that multiple generators
can create the same directory trees. When os.makedirs tries to create a
tree that already exists it raises and OSError exception, with the errno
set to 17 (the File Exists Error). Since between the time that a check
is made and the time the os.makedirs completes a second generator can
create the directory tree we can have exceptions raised sporadically,
especially as the number of threads being used to generate goes up.
We maintain the check for existence before trying to create the
directories because os.makedirs is slow, so not even trying is better
than trying in vain.
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'generated_tests/gen_texture_query_lod_tests.py')
-rw-r--r-- | generated_tests/gen_texture_query_lod_tests.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/generated_tests/gen_texture_query_lod_tests.py b/generated_tests/gen_texture_query_lod_tests.py index 16052047c..886ca6098 100644 --- a/generated_tests/gen_texture_query_lod_tests.py +++ b/generated_tests/gen_texture_query_lod_tests.py @@ -86,7 +86,12 @@ def main(): dirname = os.path.join("spec", api.lower(), "compiler", "built-in-functions") if not os.path.exists(dirname): - os.makedirs(dirname) + try: + os.makedirs(dirname) + except OSError as e: + if e.errno == 17: # file exists + pass + raise for sampler_type, coord_type in SAMPLER_TYPE_TO_COORD_TYPE.iteritems(): requirements = [requirement['extensions']] if requirement['extensions'] else [] |