From f0c8f6969f3341b51d7595cbf2c32b91e18ad96e Mon Sep 17 00:00:00 2001 From: Yihong Wang Date: Wed, 7 Mar 2018 13:34:10 -0800 Subject: [PATCH] test: fix test-abort-backtrace in shared lib build When using shared lib build, the binary path in the stack frames points to shared lib. Change the checking criteria in the test case to match that. Refs: https://github.com/nodejs/node/issues/18535 Signed-off-by: Yihong Wang PR-URL: https://github.com/nodejs/node/pull/19213 Refs: https://github.com/nodejs/node/issues/18535 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/abort/test-abort-backtrace.js | 3 ++- test/common/shared-lib-util.js | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/abort/test-abort-backtrace.js b/test/abort/test-abort-backtrace.js index e69ac3ddfd..7f87ef0e7f 100644 --- a/test/abort/test-abort-backtrace.js +++ b/test/abort/test-abort-backtrace.js @@ -19,7 +19,8 @@ if (process.argv[2] === 'child') { } if (!common.isWindows) { - if (!frames.some((frame) => frame.includes(`[${process.execPath}]`))) { + const { getBinaryPath } = require('../common/shared-lib-util'); + if (!frames.some((frame) => frame.includes(`[${getBinaryPath()}]`))) { assert.fail(`Some frames should include the binary name:\n${stderr}`); } } diff --git a/test/common/shared-lib-util.js b/test/common/shared-lib-util.js index baa989824c..89b1231e5c 100644 --- a/test/common/shared-lib-util.js +++ b/test/common/shared-lib-util.js @@ -29,7 +29,7 @@ exports.addLibraryPath = function(env) { path.dirname(process.execPath); }; -// Get the full path of shared lib +// Get the full path of shared lib. exports.getSharedLibPath = function() { if (common.isWindows) { return path.join(path.dirname(process.execPath), 'node.dll'); @@ -42,3 +42,9 @@ exports.getSharedLibPath = function() { `libnode.${process.config.variables.shlib_suffix}`); } }; + +// Get the binary path of stack frames. +exports.getBinaryPath = function() { + return process.config.variables.node_shared ? + exports.getSharedLibPath() : process.execPath; +};