Skip to content

Commit

Permalink
test: fix test-abort-backtrace in shared lib build
Browse files Browse the repository at this point in the history
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: #18535

Signed-off-by: Yihong Wang <[email protected]>

PR-URL: #19213
Refs: #18535
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
yhwang authored and targos committed Mar 17, 2018
1 parent 9fe2649 commit 1d0e717
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/abort/test-abort-backtrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}
Expand Down
8 changes: 7 additions & 1 deletion test/common/shared-lib-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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;
};

0 comments on commit 1d0e717

Please sign in to comment.