Skip to content

Commit 10d4f47

Browse files
danbevMylesBorins
authored andcommitted
test: enable addons test to pass with debug build
Currently when running configure with the --debug option in combination with the tests (./configure --debug && make -j8 test) there are a few addon tests that fail with error messages similar to this: === release test === Path: addons/load-long-path/test fs.js:558 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ Error: ENOENT: no such file or directory, open '/nodejs/node/test/addons/load-long-path/build/Release/binding.node' at Object.fs.openSync (fs.js:558:18) at Object.fs.readFileSync (fs.js:468:33) at Object.<anonymous> (/nodejs/node/test/addons/load-long-path/test.js:28:19) at Module._compile (module.js:560:32) at Object.Module._extensions..js (module.js:569:10) at Module.load (module.js:477:32) at tryModuleLoad (module.js:436:12) at Function.Module._load (module.js:428:3) at Module.runMain (module.js:594:10) at run (bootstrap_node.js:382:7) Command: out/Release/node /nodejs/node/test/addons/load-long-path/test.js This commit allows for the tests to pass even if the configured build type is of type debug. PR-URL: #8836 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 550393d commit 10d4f47

20 files changed

+31
-27
lines changed

test/addons/async-hello-world/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
2-
require('../../common');
2+
var common = require('../../common');
33
var assert = require('assert');
4-
var binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
var called = false;
66

77
process.on('exit', function() {

test/addons/at-exit/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
'use strict';
2-
require('../../common');
3-
require('./build/Release/binding');
2+
const common = require('../../common');
3+
require(`./build/${common.buildType}/binding`);

test/addons/buffer-free-callback/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22
// Flags: --expose-gc
33

4-
require('../../common');
5-
var binding = require('./build/Release/binding');
4+
const common = require('../../common');
5+
const binding = require(`./build/${common.buildType}/binding`);
66

77
function check(size) {
88
var buf = binding.alloc(size);

test/addons/heap-profiler/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
require('../../common');
3+
const common = require('../../common');
44

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

77
// Create an AsyncWrap object.
88
const timer = setTimeout(function() {}, 1);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
2-
require('../../common');
2+
const common = require('../../common');
33
var assert = require('assert');
4-
var binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
assert.equal('world', binding());
66
console.log('binding.hello() =', binding());

test/addons/hello-world/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
2-
require('../../common');
2+
const common = require('../../common');
33
var assert = require('assert');
4-
var binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
assert.equal('world', binding.hello());
66
console.log('binding.hello() =', binding.hello());

test/addons/load-long-path/test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ for (var i = 0; i < 10; i++) {
2121
fs.mkdirSync(addonDestinationDir);
2222
}
2323

24-
const addonPath = path.join(__dirname, 'build', 'Release', 'binding.node');
24+
const addonPath = path.join(__dirname,
25+
'build',
26+
common.buildType,
27+
'binding.node');
2528
const addonDestinationPath = path.join(addonDestinationDir, 'binding.node');
2629

2730
// Copy binary to long path destination

test/addons/make-callback-recurse/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const common = require('../../common');
44
const assert = require('assert');
55
const domain = require('domain');
6-
const binding = require('./build/Release/binding');
6+
const binding = require(`./build/${common.buildType}/binding`);
77
const makeCallback = binding.makeCallback;
88

99
// Make sure this is run in the future.

test/addons/make-callback/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const common = require('../../common');
44
const assert = require('assert');
55
const vm = require('vm');
6-
const binding = require('./build/Release/binding');
6+
const binding = require(`./build/${common.buildType}/binding`);
77
const makeCallback = binding.makeCallback;
88

99
assert.strictEqual(42, makeCallback(process, common.mustCall(function() {

test/addons/openssl-binding/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
'use strict';
22

3-
require('../../common');
3+
const common = require('../../common');
44
const assert = require('assert');
5-
const binding = require('./build/Release/binding');
5+
const binding = require(`./build/${common.buildType}/binding`);
66
const bytes = new Uint8Array(1024);
77
assert(binding.randomBytes(bytes));
88
assert(bytes.reduce((v, a) => v + a) > 0);

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
// v8 fails silently if string length > v8::String::kMaxLength

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-ascii.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-base64.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-hex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-utf8.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const common = require('../../common');
4-
const binding = require('./build/Release/binding');
4+
const binding = require(`./build/${common.buildType}/binding`);
55
const assert = require('assert');
66

77
const skipMessage = 'intensive toString tests due to memory confinements';

test/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ exports.isFreeBSD = process.platform === 'freebsd';
2828

2929
exports.enoughTestMem = os.totalmem() > 0x40000000; /* 1 Gb */
3030
exports.rootDir = exports.isWindows ? 'c:\\' : '/';
31+
exports.buildType = process.config.target_defaults.default_configuration;
3132

3233
function rimrafSync(p) {
3334
try {

tools/doc/addon-verify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ function verifyFiles(files, blockName, onprogress, ondone) {
6565
files = Object.keys(files).map(function(name) {
6666
if (name === 'test.js') {
6767
files[name] = `'use strict';
68-
require('../../common');
69-
${files[name]}
68+
const common = require('../../common');
69+
${files[name].replace('Release', "' + common.buildType + '")}
7070
`;
7171
}
7272
return {

0 commit comments

Comments
 (0)