Skip to content

Commit 903c07f

Browse files
yhwangMylesBorins
authored andcommitted
test: check symbols in shared lib
When building the node with `--shared` option, we need to verify the symbols in shared lib instead of executable. Refs: #18535 Signed-off-by: Yihong Wang <[email protected]> PR-URL: #18806 Refs: #18535 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent fe914c4 commit 903c07f

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

test/common/shared-lib-util.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* eslint-disable required-modules */
21
'use strict';
2+
const common = require('../common');
33
const path = require('path');
44

55
// If node executable is linked to shared lib, need to take care about the
@@ -27,3 +27,17 @@ exports.addLibraryPath = function(env) {
2727
(env.PATH ? env.PATH + path.delimiter : '') +
2828
path.dirname(process.execPath);
2929
};
30+
31+
// Get the full path of shared lib
32+
exports.getSharedLibPath = function() {
33+
if (common.isWindows) {
34+
return path.join(path.dirname(process.execPath), 'node.dll');
35+
} else if (common.isOSX) {
36+
return path.join(path.dirname(process.execPath),
37+
`libnode.${process.config.variables.shlib_suffix}`);
38+
} else {
39+
return path.join(path.dirname(process.execPath),
40+
'lib.target',
41+
`libnode.${process.config.variables.shlib_suffix}`);
42+
}
43+
};

test/parallel/test-postmortem-metadata.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
const common = require('../common');
88
const assert = require('assert');
99
const { spawnSync } = require('child_process');
10-
const args = [process.execPath];
10+
const { getSharedLibPath } = require('../common/shared-lib-util.js');
11+
12+
// For shared lib case, check shared lib instead
13+
const args = [
14+
process.config.variables.node_shared ?
15+
getSharedLibPath() : process.execPath
16+
];
1117

1218
if (common.isAIX)
1319
args.unshift('-Xany', '-B');

0 commit comments

Comments
 (0)