From e4accb6db4f185e655ff81971a9dea86225b7749 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 e69ac3ddfdece8..7f87ef0e7f4559 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 963c6ee1391d8e..36c518a2f03c94 100644 --- a/test/common/shared-lib-util.js +++ b/test/common/shared-lib-util.js @@ -28,7 +28,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'); @@ -41,3 +41,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; +};