Skip to content

Commit adee998

Browse files
sam-githubBridgeAR
authored andcommitted
test: debug output for dlopen-ping-pong test
Make test failures easier to diagnose through progress logging, and reporting of dlerror(). PR-URL: #29818 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Christian Clauss <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent a711304 commit adee998

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

test/addons/dlopen-ping-pong/binding.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ static ping ping_func;
2626
void LoadLibrary(const FunctionCallbackInfo<Value>& args) {
2727
const String::Utf8Value filename(args.GetIsolate(), args[0]);
2828
void* handle = dlopen(*filename, RTLD_LAZY);
29+
if (handle == nullptr) fprintf(stderr, "%s\n", dlerror());
2930
assert(handle != nullptr);
3031
ping_func = reinterpret_cast<ping>(dlsym(handle, "dlopen_ping"));
3132
assert(ping_func != nullptr);

test/addons/dlopen-ping-pong/test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ const path = require('path');
99
const os = require('os');
1010

1111
const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
12+
console.log('process.dlopen:', bindingPath);
1213
process.dlopen(module, bindingPath,
1314
os.constants.dlopen.RTLD_NOW | os.constants.dlopen.RTLD_GLOBAL);
15+
console.log('module.exports.load:', `${path.dirname(bindingPath)}/ping.so`);
1416
module.exports.load(`${path.dirname(bindingPath)}/ping.so`);
1517
assert.strictEqual(module.exports.ping(), 'pong');
1618

1719
// Check that after the addon is loaded with
1820
// process.dlopen() a require() call fails.
21+
console.log('require:', `./build/${common.buildType}/binding`);
1922
const re = /^Error: Module did not self-register\.$/;
2023
assert.throws(() => require(`./build/${common.buildType}/binding`), re);

0 commit comments

Comments
 (0)