Catch File Exists on makedirs to better support parallel runs

master
Marius Kintel 2014-05-28 20:36:40 -04:00
parent ce24e2e29b
commit 22e46762f8
1 changed files with 10 additions and 2 deletions

View File

@ -143,10 +143,18 @@ def run_test(testname, cmd, args):
cmdname = os.path.split(options.cmd)[1]
if options.generate:
if not os.path.exists(expecteddir): os.makedirs(expecteddir)
if not os.path.exists(expecteddir):
try:
os.makedirs(expecteddir)
except OSError as e:
if e.errno != 17: raise e # catch File Exists to allow parallel runs
outputname = expectedfilename
else:
if not os.path.exists(actualdir): os.makedirs(actualdir)
if not os.path.exists(actualdir):
try:
os.makedirs(actualdir)
except OSError as e:
if e.errno != 17: raise e # catch File Exists to allow parallel runs
outputname = actualfilename
outputname = os.path.normpath(outputname)