You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
835 B

'use strict';
const common = require('../../common');
if (common.isWindows)
common.skip('dlopen global symbol loading is not supported on this os.');
if (common.isAIX)
common.skip('this test does not pass on AIX.');
const assert = require('assert');
const path = require('path');
const os = require('os');
const bindingPath = require.resolve(`./build/${common.buildType}/binding`);
process.dlopen(module, bindingPath,
os.constants.dlopen.RTLD_NOW | os.constants.dlopen.RTLD_GLOBAL);
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.
const re = /^Error: Module did not self-register\.$/;
assert.throws(() => require(`./build/${common.buildType}/binding`), re);