Skip to content

Commit 74fa505

Browse files
danbevjasnell
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 <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Ilkka Myller <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent aa5664f commit 74fa505

File tree

24 files changed

+37
-33
lines changed

24 files changed

+37
-33
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
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

66
binding(5, common.mustCall(function(err, val) {
77
assert.equal(null, err);

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, alignment, offset) {
88
var buf = binding.alloc(size, alignment, offset);

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() {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
binding.run();

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/parse-encoding/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 { parseEncoding } = require('./build/Release/binding');
5+
const { parseEncoding } = require(`./build/${common.buildType}/binding`);
66

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

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/addons/symlinked-module/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const assert = require('assert');
1414

1515
common.refreshTmpDir();
1616

17-
const addonPath = path.join(__dirname, 'build', 'Release');
17+
const addonPath = path.join(__dirname, 'build', common.buildType);
1818
const addonLink = path.join(common.tmpDir, 'addon');
1919

2020
try {

test/addons/zlib-binding/test.js

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

3-
require('../../common');
3+
const common = require('../../common');
44
const assert = require('assert');
55
const zlib = require('zlib');
6-
const binding = require('./build/Release/binding');
6+
const binding = require(`./build/${common.buildType}/binding`);
77

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

test/common.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const cpus = os.cpus();
3636
exports.enoughTestCpu = cpus.length > 1 || cpus[0].speed > 999;
3737

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

4041
function rimrafSync(p) {
4142
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)