Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: enable addons test to pass with debug build #8836

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/addons/async-hello-world/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const common = require('../../common');
var assert = require('assert');
var binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);

binding(5, common.mustCall(function(err, val) {
assert.equal(null, err);
Expand Down
4 changes: 2 additions & 2 deletions test/addons/at-exit/test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
require('../../common');
require('./build/Release/binding');
const common = require('../../common');
require(`./build/${common.buildType}/binding`);
4 changes: 2 additions & 2 deletions test/addons/buffer-free-callback/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';
// Flags: --expose-gc

require('../../common');
var binding = require('./build/Release/binding');
const common = require('../../common');
const binding = require(`./build/${common.buildType}/binding`);

function check(size, alignment, offset) {
var buf = binding.alloc(size, alignment, offset);
Expand Down
4 changes: 2 additions & 2 deletions test/addons/heap-profiler/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

require('../../common');
const common = require('../../common');

const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);

// Create an AsyncWrap object.
const timer = setTimeout(function() {}, 1);
Expand Down
4 changes: 2 additions & 2 deletions test/addons/hello-world-function-export/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
require('../../common');
const common = require('../../common');
var assert = require('assert');
var binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
assert.equal('world', binding());
console.log('binding.hello() =', binding());
4 changes: 2 additions & 2 deletions test/addons/hello-world/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
require('../../common');
const common = require('../../common');
var assert = require('assert');
var binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
assert.equal('world', binding.hello());
console.log('binding.hello() =', binding.hello());
5 changes: 4 additions & 1 deletion test/addons/load-long-path/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ for (var i = 0; i < 10; i++) {
fs.mkdirSync(addonDestinationDir);
}

const addonPath = path.join(__dirname, 'build', 'Release', 'binding.node');
const addonPath = path.join(__dirname,
'build',
common.buildType,
'binding.node');
const addonDestinationPath = path.join(addonDestinationDir, 'binding.node');

// Copy binary to long path destination
Expand Down
2 changes: 1 addition & 1 deletion test/addons/make-callback-recurse/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const common = require('../../common');
const assert = require('assert');
const domain = require('domain');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const makeCallback = binding.makeCallback;

// Make sure this is run in the future.
Expand Down
2 changes: 1 addition & 1 deletion test/addons/make-callback/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const common = require('../../common');
const assert = require('assert');
const vm = require('vm');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const makeCallback = binding.makeCallback;

assert.strictEqual(42, makeCallback(process, common.mustCall(function() {
Expand Down
4 changes: 2 additions & 2 deletions test/addons/null-buffer-neuter/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
// Flags: --expose-gc

require('../../common');
var binding = require('./build/Release/binding');
const common = require('../../common');
const binding = require(`./build/${common.buildType}/binding`);

binding.run();
4 changes: 2 additions & 2 deletions test/addons/openssl-binding/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

require('../../common');
const common = require('../../common');
const assert = require('assert');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const bytes = new Uint8Array(1024);
assert(binding.randomBytes(bytes));
assert(bytes.reduce((v, a) => v + a) > 0);
4 changes: 2 additions & 2 deletions test/addons/parse-encoding/test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

require('../../common');
const common = require('../../common');
const assert = require('assert');
const { parseEncoding } = require('./build/Release/binding');
const { parseEncoding } = require(`./build/${common.buildType}/binding`);

assert.strictEqual(parseEncoding(''), 'UNKNOWN');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

// v8 fails silently if string length > v8::String::kMaxLength
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const common = require('../../common');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);
const assert = require('assert');

const skipMessage = 'intensive toString tests due to memory confinements';
Expand Down
2 changes: 1 addition & 1 deletion test/addons/symlinked-module/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const assert = require('assert');

common.refreshTmpDir();

const addonPath = path.join(__dirname, 'build', 'Release');
const addonPath = path.join(__dirname, 'build', common.buildType);
const addonLink = path.join(common.tmpDir, 'addon');

try {
Expand Down
4 changes: 2 additions & 2 deletions test/addons/zlib-binding/test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

require('../../common');
const common = require('../../common');
const assert = require('assert');
const zlib = require('zlib');
const binding = require('./build/Release/binding');
const binding = require(`./build/${common.buildType}/binding`);

const input = Buffer.from('Hello, World!');

Expand Down
1 change: 1 addition & 0 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const cpus = os.cpus();
exports.enoughTestCpu = cpus.length > 1 || cpus[0].speed > 999;

exports.rootDir = exports.isWindows ? 'c:\\' : '/';
exports.buildType = process.config.target_defaults.default_configuration;

function rimrafSync(p) {
try {
Expand Down
4 changes: 2 additions & 2 deletions tools/doc/addon-verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ function verifyFiles(files, blockName, onprogress, ondone) {
files = Object.keys(files).map(function(name) {
if (name === 'test.js') {
files[name] = `'use strict';
require('../../common');
${files[name]}
const common = require('../../common');
${files[name].replace('Release', "' + common.buildType + '")}
`;
}
return {
Expand Down