From a239491caefd8516c9028b949068e2c67d3d5b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bergstr=C3=B6m?= Date: Wed, 9 Dec 2015 15:48:26 +1100 Subject: [PATCH] fix: bail if directory isn't writable Since we can't exit from common.js, create an error code and exit from the test runner instead. --- test/common.js | 2 +- tools/test.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/test/common.js b/test/common.js index 7e91194cf0291e..b7e15e03156fd9 100644 --- a/test/common.js +++ b/test/common.js @@ -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); } } diff --git a/tools/test.py b/tools/test.py index 4baca769c25ee5..45e40b129aa321 100755 --- a/tools/test.py +++ b/tools/test.py @@ -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) @@ -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