aboutsummaryrefslogtreecommitdiff
path: root/tools/test.py
diff options
context:
space:
mode:
authorJohan Bergström <bugs@bergstroem.nu>2015-10-12 15:11:57 +1100
committerJohan Bergström <bugs@bergstroem.nu>2015-12-30 15:47:37 +1100
commit8132b942a74e9a3ebbc1e83159fb8777f93e83c6 (patch)
tree50c0c2d9416d772a286d5dbee4af2c57645d1f92 /tools/test.py
parentf241d6685b6d63e2170040b37a064e0d502847b7 (diff)
downloadandroid-node-v8-8132b942a74e9a3ebbc1e83159fb8777f93e83c6.tar.gz
android-node-v8-8132b942a74e9a3ebbc1e83159fb8777f93e83c6.tar.bz2
android-node-v8-8132b942a74e9a3ebbc1e83159fb8777f93e83c6.zip
test: make temp path customizable
In CI we previously passed `NODE_COMMON_PIPE` to the test runner to avoid long filenames. Add an option to the test runner that allows the user to change the temporary directory instead. This also allows us to run test suites in parallel since `NODE_COMMON_PIPE` otherwise would have been used from multiple tests at the same time. PR-URL: https://github.com/nodejs/node/pull/3325 Reviewed-By: Joao Reis <reis@janeasystems.com>
Diffstat (limited to 'tools/test.py')
-rwxr-xr-xtools/test.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/test.py b/tools/test.py
index 4baca769c2..214d634fe5 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -1310,6 +1310,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
@@ -1538,6 +1540,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)