Skip to content

Commit f96e027

Browse files
committed
fix: move directory creation to test.py
1 parent a239491 commit f96e027

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

test/common.js

-8
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ function rmdirSync(p, originalEr) {
6666
}
6767

6868
exports.refreshTmpDir = function() {
69-
try {
70-
fs.accessSync(testRoot, fs.W_OK);
71-
} catch (e) {
72-
if (e.code === 'ENOENT') {
73-
process.exit(101);
74-
}
75-
}
76-
7769
rimrafSync(exports.tmpDir);
7870
fs.mkdirSync(exports.tmpDir);
7971
};

tools/test.py

+12
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,8 @@ def BuildOptions():
13181318
result.add_option("-r", "--run",
13191319
help="Divide the tests in m groups (interleaved) and run tests from group n (--run=n,m with n < m)",
13201320
default="")
1321+
result.add_option('--temp-dir',
1322+
help='Optional path to change directory used for tests', default=False)
13211323
return result
13221324

13231325

@@ -1546,6 +1548,16 @@ def Main():
15461548
for rule in globally_unused_rules:
15471549
print "Rule for '%s' was not used." % '/'.join([str(s) for s in rule.path])
15481550

1551+
tempdir = os.environ.get('NODE_TEST_DIR') or options.temp_dir
1552+
if tempdir:
1553+
try:
1554+
os.makedirs(tempdir)
1555+
os.environ['NODE_TEST_DIR'] = tempdir
1556+
except OSError as exception:
1557+
if exception.errno != errno.EEXIST:
1558+
print "Could not create the temporary directory", options.temp_dir
1559+
sys.exit(1)
1560+
15491561
if options.report:
15501562
PrintReport(all_cases)
15511563

0 commit comments

Comments
 (0)