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.

38 lines
1.1 KiB

'use strict';
const common = require('../../common');
const fs = require('fs');
const path = require('path');
const assert = require('assert');
if (common.isWOW64) {
common.skip('doesn\'t work on WOW64');
return;
}
common.refreshTmpDir();
// make a path that is more than 260 chars long.
// Any given folder cannot have a name longer than 260 characters,
// so create 10 nested folders each with 30 character long names.
var addonDestinationDir = path.resolve(common.tmpDir);
for (var i = 0; i < 10; i++) {
addonDestinationDir = path.join(addonDestinationDir, 'x'.repeat(30));
fs.mkdirSync(addonDestinationDir);
}
test: enable addons test to pass with debug build Currently when running configure with the --debug option in combination with the tests (./configure --debug &amp;&amp; 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 &#39;/nodejs/node/test/addons/load-long-path/build/Release/binding.node&#39; at Object.fs.openSync (fs.js:558:18) at Object.fs.readFileSync (fs.js:468:33) at Object.&lt;anonymous&gt; (/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 &lt;jasnell@gmail.com&gt; Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt; Reviewed-By: Ben Noordhuis &lt;info@bnoordhuis.nl&gt; Reviewed-By: Ilkka Myller &lt;ilkka.myller@nodefield.com&gt; Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt; Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
8 years ago
const addonPath = path.join(__dirname,
'build',
common.buildType,
'binding.node');
const addonDestinationPath = path.join(addonDestinationDir, 'binding.node');
// Copy binary to long path destination
var contents = fs.readFileSync(addonPath);
fs.writeFileSync(addonDestinationPath, contents);
// Attempt to load at long path destination
var addon = require(addonDestinationPath);
assert.notEqual(addon, null);
assert.strictEqual(addon.hello(), 'world');