summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-05-18 01:20:25 +0200
committerAnna Henningsen <anna@addaleax.net>2018-06-06 19:44:11 +0200
commit229dca3dee552f448dc9026237625ed58e8acfdc (patch)
tree3d463874affcf1303318882fb2f9961f5aec7cca /tools
parentd1c096cc9d88a865094b91ef86b771cd23d8bfe7 (diff)
downloadandroid-node-v8-229dca3dee552f448dc9026237625ed58e8acfdc.tar.gz
android-node-v8-229dca3dee552f448dc9026237625ed58e8acfdc.tar.bz2
android-node-v8-229dca3dee552f448dc9026237625ed58e8acfdc.zip
test,tools: enable running tests under workers
Enable running tests inside workers by passing `--worker` to `tools/test.py`. A number of tests are marked as skipped, or have been slightly altered to fit the different environment. PR-URL: https://github.com/nodejs/node/pull/20876 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'tools')
-rw-r--r--tools/run-worker.js11
-rwxr-xr-xtools/test.py7
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/run-worker.js b/tools/run-worker.js
new file mode 100644
index 0000000000..a9dd773ecf
--- /dev/null
+++ b/tools/run-worker.js
@@ -0,0 +1,11 @@
+'use strict';
+if (typeof require === 'undefined') {
+ console.log('1..0 # Skipped: Not being run as CommonJS');
+ process.exit(0);
+}
+
+const path = require('path');
+const { Worker } = require('worker');
+
+new Worker(path.resolve(process.cwd(), process.argv[2]))
+ .on('exit', (code) => process.exitCode = code);
diff --git a/tools/test.py b/tools/test.py
index e5581e8da4..27a2722438 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -1375,6 +1375,8 @@ def BuildOptions():
help="Expect test cases to fail", default=False, action="store_true")
result.add_option("--valgrind", help="Run tests through valgrind",
default=False, action="store_true")
+ result.add_option("--worker", help="Run parallel tests inside a worker context",
+ default=False, action="store_true")
result.add_option("--check-deopts", help="Check tests for permanent deoptimizations",
default=False, action="store_true")
result.add_option("--cat", help="Print the source of the tests",
@@ -1617,6 +1619,11 @@ def Main():
options.node_args.append("--always-opt")
options.progress = "deopts"
+ if options.worker:
+ run_worker = join(workspace, "tools", "run-worker.js")
+ options.node_args.append('--experimental-worker')
+ options.node_args.append(run_worker)
+
shell = abspath(options.shell)
buildspace = dirname(shell)