0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 20:29:23 +01:00

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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Daniel Bevenius 2016-09-28 20:14:23 +02:00 committed by James M Snell
parent 47d1588e75
commit fdca79fbc0
24 changed files with 37 additions and 33 deletions

View File

@ -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);

View File

@ -1,3 +1,3 @@
'use strict';
require('../../common');
require('./build/Release/binding');
const common = require('../../common');
require(`./build/${common.buildType}/binding`);

View File

@ -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);

View File

@ -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);

View File

@ -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());

View File

@ -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());

View File

@ -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

View File

@ -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.

View File

@ -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() {

View File

@ -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();

View File

@ -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);

View File

@ -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');

View File

@ -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

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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 {

View File

@ -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!');

View File

@ -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 {

View File

@ -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 {