diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-10-02 14:47:08 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2019-10-09 11:54:59 -0700 |
commit | 51c097b2a86b3c33d3dff343ef106843def21d9c (patch) | |
tree | fd2c09189b926e826c27ca9ad0aa2266b5e57464 | |
parent | 6db45bf7def22eedfd95dac95713e850c366b169 (diff) | |
download | android-node-v8-51c097b2a86b3c33d3dff343ef106843def21d9c.tar.gz android-node-v8-51c097b2a86b3c33d3dff343ef106843def21d9c.tar.bz2 android-node-v8-51c097b2a86b3c33d3dff343ef106843def21d9c.zip |
test: debug output for dlopen-ping-pong test
Make test failures easier to diagnose through progress logging, and
reporting of dlerror().
PR-URL: https://github.com/nodejs/node/pull/29818
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
-rw-r--r-- | test/addons/dlopen-ping-pong/binding.cc | 1 | ||||
-rw-r--r-- | test/addons/dlopen-ping-pong/test.js | 3 |
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); |