summaryrefslogtreecommitdiff
path: root/generated_tests/gen_texture_lod_tests.py
diff options
context:
space:
mode:
authorDylan Baker <dylanx.c.baker@intel.com>2014-12-11 15:32:46 -0800
committerDylan Baker <dylanx.c.baker@intel.com>2014-12-12 16:29:58 -0800
commitb59ff71eb37b3ee01e5a34dda1a7ccbd4ba936f0 (patch)
tree499bf522297b5a7d83879e41303cca448402a3a0 /generated_tests/gen_texture_lod_tests.py
parentc1cf7865e742666ba46197827af1a854215cbd17 (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_lod_tests.py')
-rw-r--r--generated_tests/gen_texture_lod_tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/generated_tests/gen_texture_lod_tests.py b/generated_tests/gen_texture_lod_tests.py
index a2f43fa16..52f587015 100644
--- a/generated_tests/gen_texture_lod_tests.py
+++ b/generated_tests/gen_texture_lod_tests.py
@@ -76,7 +76,12 @@ def main():
"""
dirname = 'spec/arb_shader_texture_lod/compiler'
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 params in LOD_TESTS:
name = os.path.join(