summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/addons/dlopen-ping-pong/binding.cc1
-rw-r--r--test/addons/dlopen-ping-pong/test.js3
2 files changed, 4 insertions, 0 deletions
diff --git a/test/addons/dlopen-ping-pong/binding.cc b/test/addons/dlopen-ping-pong/binding.cc
index 6a6c297b52..ecdabd5e0f 100644
--- a/test/addons/dlopen-ping-pong/binding.cc
+++ b/test/addons/dlopen-ping-pong/binding.cc
@@ -26,6 +26,7 @@ static ping ping_func;
void LoadLibrary(const FunctionCallbackInfo<Value>& args) {
const String::Utf8Value filename(args.GetIsolate(), args[0]);
void* handle = dlopen(*filename, RTLD_LAZY);
+ if (handle == nullptr) fprintf(stderr, "%s\n", dlerror());
assert(handle != nullptr);
ping_func = reinterpret_cast<ping>(dlsym(handle, "dlopen_ping"));
assert(ping_func != nullptr);
diff --git a/test/addons/dlopen-ping-pong/test.js b/test/addons/dlopen-ping-pong/test.js
index c533593496..c5b8c16493 100644
--- a/test/addons/dlopen-ping-pong/test.js
+++ b/test/addons/dlopen-ping-pong/test.js
@@ -9,12 +9,15 @@ const path = require('path');
const os = require('os');
const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
+console.log('process.dlopen:', bindingPath);
process.dlopen(module, bindingPath,
os.constants.dlopen.RTLD_NOW | os.constants.dlopen.RTLD_GLOBAL);
+console.log('module.exports.load:', `${path.dirname(bindingPath)}/ping.so`);
module.exports.load(`${path.dirname(bindingPath)}/ping.so`);
assert.strictEqual(module.exports.ping(), 'pong');
// Check that after the addon is loaded with
// process.dlopen() a require() call fails.
+console.log('require:', `./build/${common.buildType}/binding`);
const re = /^Error: Module did not self-register\.$/;
assert.throws(() => require(`./build/${common.buildType}/binding`), re);