Skip to content

Commit

Permalink
test: check symbols in shared lib
Browse files Browse the repository at this point in the history
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 <yh.wang@ibm.com>
PR-URL: #18806
Refs: #18535
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
yhwang authored and MylesBorins committed Aug 16, 2018
1 parent 8fad7af commit 2f6866e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
16 changes: 15 additions & 1 deletion test/common/shared-lib-util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable required-modules */
'use strict';
const common = require('../common');
const path = require('path');

// If node executable is linked to shared lib, need to take care about the
Expand Down Expand Up @@ -27,3 +27,17 @@ exports.addLibraryPath = function(env) {
(env.PATH ? env.PATH + path.delimiter : '') +
path.dirname(process.execPath);
};

// Get the full path of shared lib
exports.getSharedLibPath = function() {
if (common.isWindows) {
return path.join(path.dirname(process.execPath), 'node.dll');
} else if (common.isOSX) {
return path.join(path.dirname(process.execPath),
`libnode.${process.config.variables.shlib_suffix}`);
} else {
return path.join(path.dirname(process.execPath),
'lib.target',
`libnode.${process.config.variables.shlib_suffix}`);
}
};
8 changes: 7 additions & 1 deletion test/parallel/test-postmortem-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
const common = require('../common');
const assert = require('assert');
const { spawnSync } = require('child_process');
const args = [process.execPath];
const { getSharedLibPath } = require('../common/shared-lib-util.js');

// For shared lib case, check shared lib instead
const args = [
process.config.variables.node_shared ?
getSharedLibPath() : process.execPath
];

if (common.isAIX)
args.unshift('-Xany', '-B');
Expand Down

0 comments on commit 2f6866e

Please sign in to comment.