Skip to content

Commit

Permalink
fix: bail if directory isn't writable
Browse files Browse the repository at this point in the history
Since we can't exit from common.js, create an error code
and exit from the test runner instead.
  • Loading branch information
jbergstroem committed Dec 29, 2015
1 parent a686076 commit a239491
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ exports.refreshTmpDir = function() {
fs.accessSync(testRoot, fs.W_OK);
} catch (e) {
if (e.code === 'ENOENT') {
fs.mkdirSync(testRoot);
process.exit(101);
}
}

Expand Down
8 changes: 8 additions & 0 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ def RunSingle(self, parallel, thread_id):
if self.shutdown_event.is_set():
return
self.lock.acquire()
if output.ShouldExit():
self.lock.release()
PrintError("\nThe temporary folder you specified doesn't exist or" \
" can't be written to. Take necessary actions and try again")
os._exit(1)
if output.UnexpectedOutput():
if FLAKY in output.test.outcomes and self.flaky_tests_mode == DONTCARE:
self.flaky_failed.append(output)
Expand Down Expand Up @@ -497,6 +502,9 @@ def __init__(self, test, command, output, store_unexpected_output):
self.store_unexpected_output = store_unexpected_output
self.diagnostic = []

def ShouldExit(self):
return self.output.exit_code == 101

def UnexpectedOutput(self):
if self.HasCrashed():
outcome = CRASH
Expand Down

0 comments on commit a239491

Please sign in to comment.