From f96e027a22c0f4ac81a4f43f537e78bbd0a5f940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Tue, 29 Dec 2015 12:54:07 +1100 Subject: [PATCH] fix: move directory creation to test.py --- test/common.js | 8 -------- tools/test.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/test/common.js b/test/common.js index b7e15e03156fd9..b0e832583bd79c 100644 --- a/test/common.js +++ b/test/common.js @@ -66,14 +66,6 @@ function rmdirSync(p, originalEr) { } exports.refreshTmpDir = function() { - try { - fs.accessSync(testRoot, fs.W_OK); - } catch (e) { - if (e.code === 'ENOENT') { - process.exit(101); - } - } - rimrafSync(exports.tmpDir); fs.mkdirSync(exports.tmpDir); }; diff --git a/tools/test.py b/tools/test.py index 45e40b129aa321..1973ffc50827c3 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1318,6 +1318,8 @@ def BuildOptions(): result.add_option("-r", "--run", help="Divide the tests in m groups (interleaved) and run tests from group n (--run=n,m with n < m)", default="") + result.add_option('--temp-dir', + help='Optional path to change directory used for tests', default=False) return result @@ -1546,6 +1548,16 @@ def Main(): for rule in globally_unused_rules: print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path]) + tempdir = os.environ.get('NODE_TEST_DIR') or options.temp_dir + if tempdir: + try: + os.makedirs(tempdir) + os.environ['NODE_TEST_DIR'] = tempdir + except OSError as exception: + if exception.errno != errno.EEXIST: + print "Could not create the temporary directory", options.temp_dir + sys.exit(1) + if options.report: PrintReport(all_cases)