Skip to content

Commit f0c8f69

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]> 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 530b8a4 commit f0c8f69

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
@@ -29,7 +29,7 @@ exports.addLibraryPath = function(env) {
2929
path.dirname(process.execPath);
3030
};
3131

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

0 commit comments

Comments
 (0)