Skip to content

Commit 9c781f0

Browse files
yhwangMylesBorins
authored andcommitted
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: #18535 Signed-off-by: Yihong Wang <[email protected]> Backport-PR-URL: #22380 PR-URL: #19213 Refs: #18535 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent a0fd0b6 commit 9c781f0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

test/abort/test-abort-backtrace.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ if (process.argv[2] === 'child') {
1919
}
2020

2121
if (!common.isWindows) {
22-
if (!frames.some((frame) => frame.includes(`[${process.execPath}]`))) {
22+
const { getBinaryPath } = require('../common/shared-lib-util');
23+
if (!frames.some((frame) => frame.includes(`[${getBinaryPath()}]`))) {
2324
assert.fail(`Some frames should include the binary name:\n${stderr}`);
2425
}
2526
}

test/common/shared-lib-util.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ exports.addLibraryPath = function(env) {
2828
path.dirname(process.execPath);
2929
};
3030

31-
// Get the full path of shared lib
31+
// Get the full path of shared lib.
3232
exports.getSharedLibPath = function() {
3333
if (common.isWindows) {
3434
return path.join(path.dirname(process.execPath), 'node.dll');
@@ -41,3 +41,9 @@ exports.getSharedLibPath = function() {
4141
`libnode.${process.config.variables.shlib_suffix}`);
4242
}
4343
};
44+
45+
// Get the binary path of stack frames.
46+
exports.getBinaryPath = function() {
47+
return process.config.variables.node_shared ?
48+
exports.getSharedLibPath() : process.execPath;
49+
};

0 commit comments

Comments
 (0)