Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: remove unneeded temp directory handling #6094

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,35 @@ function rmdirSync(p, originalEr) {
}
}

function mkdirpSync(p, made) {
if (!made)
made = null;

try {
fs.mkdirSync(p);
made = made || p;
} catch (err0) {
if (err0.code === 'ENOENT') {
made = mkdirpSync(path.dirname(p), made);
mkdirpSync(p, made);
return made;
}

var stat;
try {
stat = fs.statSync(p);
} catch (err1) {
throw err0;
}
if (!stat.isDirectory())
throw err0;
}
return made;
}

exports.refreshTmpDir = function() {
rimrafSync(exports.tmpDir);
fs.mkdirSync(exports.tmpDir);
mkdirpSync(exports.tmpDir);
};

if (process.env.TEST_THREAD_ID) {
Expand Down
11 changes: 2 additions & 9 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1562,15 +1562,8 @@ 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 not os.environ.get('NODE_TEST_DIR') and options.temp_dir:
os.environ['NODE_TEST_DIR'] = options.temp_dir

if options.report:
PrintReport(all_cases)
Expand Down