From c63d511c137130030c263fb98d0d261105244c08 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 9 Dec 2019 10:53:02 +0800 Subject: bootstrap: use different scripts to setup different configurations This patch splits the handling of `isMainThread` and `ownsProcessState` from conditionals in `lib/internal/bootstrap/node.js` into different scripts under `lib/internal/bootstrap/switches/`, and call them accordingly from C++ after `node.js` is run. This: - Creates a common denominator of the main thread and the worker thread bootstrap that can be snapshotted and shared by both. - Makes it possible to override the configurations on-the-fly. PR-URL: https://github.com/nodejs/node/pull/30862 Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu --- test/parallel/test-bootstrap-modules.js | 6 ++---- test/parallel/test-dummy-stdio.js | 6 ++++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 55a989a9672..23d47c5e237 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -61,6 +61,7 @@ const expectedModules = new Set([ 'NativeModule internal/process/execution', 'NativeModule internal/process/per_thread', 'NativeModule internal/process/promises', + 'NativeModule internal/process/signal', 'NativeModule internal/process/task_queues', 'NativeModule internal/process/warning', 'NativeModule internal/querystring', @@ -79,10 +80,7 @@ const expectedModules = new Set([ 'NativeModule vm', ]); -if (common.isMainThread) { - expectedModules.add('NativeModule internal/process/main_thread_only'); - expectedModules.add('NativeModule internal/process/stdio'); -} else { +if (!common.isMainThread) { expectedModules.add('Internal Binding messaging'); expectedModules.add('Internal Binding symbols'); expectedModules.add('Internal Binding worker'); diff --git a/test/parallel/test-dummy-stdio.js b/test/parallel/test-dummy-stdio.js index 165c2c2c575..4866f85c7de 100644 --- a/test/parallel/test-dummy-stdio.js +++ b/test/parallel/test-dummy-stdio.js @@ -9,8 +9,10 @@ if (common.isWindows) function runTest(fd, streamName, testOutputStream, expectedName) { const result = child_process.spawnSync(process.execPath, [ '--expose-internals', - '-e', ` - require('internal/process/stdio').resetStdioForTesting(); + '--no-warnings', + '-e', + `const { internalBinding } = require('internal/test/binding'); + internalBinding('process_methods').resetStdioForTesting(); fs.closeSync(${fd}); const ctorName = process.${streamName}.constructor.name; process.${testOutputStream}.write(ctorName); -- cgit v1.2.3