Bug 1480879 - Report errors creating directory (other than File exists), r=jonco
authorSteve Fink <sfink@mozilla.com>
Thu, 02 Aug 2018 13:01:02 -0700
changeset 441539 3a02fd73f28641c2150ebe8d8e4529769e871b96
parent 441538 47d9c24f99d74b69396b503ba00b36e15dd9ef3c
child 441540 4ddc76989782be51553a2fb904c7c6284908fa72
push id34867
push usershindli@mozilla.com
push dateWed, 17 Oct 2018 00:55:53 +0000
treeherdermozilla-central@778427bb6353 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1480879
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1480879 - Report errors creating directory (other than File exists), r=jonco
js/src/devtools/rootAnalysis/run-test.py
--- a/js/src/devtools/rootAnalysis/run-test.py
+++ b/js/src/devtools/rootAnalysis/run-test.py
@@ -71,31 +71,34 @@ if not cfg.sixgill_plugin:
 
 subprocess.check_call([cfg.js, '-e', 'if (!getBuildConfiguration()["has-ctypes"]) quit(1)'])
 
 
 def binpath(prog):
     return os.path.join(cfg.sixgill_bin, prog)
 
 
-outroot = os.path.join(testdir, 'out')
+def make_dir(dirname, exist_ok=True):
+    try:
+        os.mkdir(dirname)
+    except OSError as e:
+        if exist_ok and e.strerror == 'File exists':
+            pass
+        else:
+            raise
 
-try:
-    os.mkdir(outroot)
-except OSError:
-    pass
+
+outroot = os.path.join(testdir, 'out')
+make_dir(outroot)
 
 for name in cfg.tests:
     name = os.path.basename(name)
     indir = os.path.join(testdir, name)
     outdir = os.path.join(outroot, name)
-    try:
-        os.mkdir(outdir)
-    except OSError:
-        pass
+    make_dir(outdir)
 
     test = Test(indir, outdir, cfg, verbose=cfg.verbose)
 
     os.chdir(outdir)
     for xdb in glob("*.xdb"):
         os.unlink(xdb)
     if cfg.verbose:
         print("Running test %s" % name)