Skip to content

Commit e4accb6

Browse files
yhwangjasnell
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: nodejs#18535 Signed-off-by: Yihong Wang <yh.wang@ibm.com> PR-URL: nodejs#19213 Refs: nodejs#18535 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent cf5c370 commit e4accb6

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)