test: use common.isWindows consistently
In the tests, we use "process.platform === 'win32'" in some places. This patch replaces them with the "common.isWindows" for consistency. PR-URL: https://github.com/nodejs/io.js/pull/2269 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
parent
fa98b97171
commit
d5ab92bcc1
@ -119,7 +119,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() {
|
|||||||
opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
|
opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') opensslCli += '.exe';
|
if (exports.isWindows) opensslCli += '.exe';
|
||||||
|
|
||||||
var openssl_cmd = child_process.spawnSync(opensslCli, ['version']);
|
var openssl_cmd = child_process.spawnSync(opensslCli, ['version']);
|
||||||
if (openssl_cmd.status !== 0 || openssl_cmd.error !== undefined) {
|
if (openssl_cmd.status !== 0 || openssl_cmd.error !== undefined) {
|
||||||
@ -133,7 +133,7 @@ Object.defineProperty(exports, 'hasCrypto', {get: function() {
|
|||||||
return process.versions.openssl ? true : false;
|
return process.versions.openssl ? true : false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
exports.PIPE = '\\\\.\\pipe\\libuv-test';
|
exports.PIPE = '\\\\.\\pipe\\libuv-test';
|
||||||
} else {
|
} else {
|
||||||
exports.PIPE = exports.tmpDir + '/test.sock';
|
exports.PIPE = exports.tmpDir + '/test.sock';
|
||||||
@ -150,7 +150,7 @@ if (process.env.NODE_COMMON_PIPE) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
exports.faketimeCli = false;
|
exports.faketimeCli = false;
|
||||||
} else {
|
} else {
|
||||||
exports.faketimeCli = path.join(__dirname, '..', 'tools', 'faketime', 'src',
|
exports.faketimeCli = path.join(__dirname, '..', 'tools', 'faketime', 'src',
|
||||||
@ -183,7 +183,7 @@ exports.indirectInstanceOf = function(obj, cls) {
|
|||||||
|
|
||||||
|
|
||||||
exports.ddCommand = function(filename, kilobytes) {
|
exports.ddCommand = function(filename, kilobytes) {
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
var p = path.resolve(exports.fixturesDir, 'create-file.js');
|
var p = path.resolve(exports.fixturesDir, 'create-file.js');
|
||||||
return '"' + process.argv[0] + '" "' + p + '" "' +
|
return '"' + process.argv[0] + '" "' + p + '" "' +
|
||||||
filename + '" ' + (kilobytes * 1024);
|
filename + '" ' + (kilobytes * 1024);
|
||||||
@ -196,7 +196,7 @@ exports.ddCommand = function(filename, kilobytes) {
|
|||||||
exports.spawnCat = function(options) {
|
exports.spawnCat = function(options) {
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
return spawn('more', [], options);
|
return spawn('more', [], options);
|
||||||
} else {
|
} else {
|
||||||
return spawn('cat', [], options);
|
return spawn('cat', [], options);
|
||||||
@ -207,7 +207,7 @@ exports.spawnCat = function(options) {
|
|||||||
exports.spawnSyncCat = function(options) {
|
exports.spawnSyncCat = function(options) {
|
||||||
var spawnSync = require('child_process').spawnSync;
|
var spawnSync = require('child_process').spawnSync;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
return spawnSync('more', [], options);
|
return spawnSync('more', [], options);
|
||||||
} else {
|
} else {
|
||||||
return spawnSync('cat', [], options);
|
return spawnSync('cat', [], options);
|
||||||
@ -218,7 +218,7 @@ exports.spawnSyncCat = function(options) {
|
|||||||
exports.spawnPwd = function(options) {
|
exports.spawnPwd = function(options) {
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
return spawn('cmd.exe', ['/c', 'cd'], options);
|
return spawn('cmd.exe', ['/c', 'cd'], options);
|
||||||
} else {
|
} else {
|
||||||
return spawn('pwd', [], options);
|
return spawn('pwd', [], options);
|
||||||
@ -374,7 +374,7 @@ exports.checkSpawnSyncRet = function(ret) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var etcServicesFileName = path.join('/etc', 'services');
|
var etcServicesFileName = path.join('/etc', 'services');
|
||||||
if (process.platform === 'win32') {
|
if (exports.isWindows) {
|
||||||
etcServicesFileName = path.join(process.env.SystemRoot, 'System32', 'drivers',
|
etcServicesFileName = path.join(process.env.SystemRoot, 'System32', 'drivers',
|
||||||
'etc', 'services');
|
'etc', 'services');
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ assert.throws(function() {
|
|||||||
// Windows doesn't usually have an entry for localhost 127.0.0.1 in
|
// Windows doesn't usually have an entry for localhost 127.0.0.1 in
|
||||||
// C:\Windows\System32\drivers\etc\hosts
|
// C:\Windows\System32\drivers\etc\hosts
|
||||||
// so we disable this test on Windows.
|
// so we disable this test on Windows.
|
||||||
if (process.platform != 'win32') {
|
if (!common.isWindows) {
|
||||||
dns.resolve('127.0.0.1', 'PTR', function(error, domains) {
|
dns.resolve('127.0.0.1', 'PTR', function(error, domains) {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
assert.ok(Array.isArray(domains));
|
assert.ok(Array.isArray(domains));
|
||||||
|
@ -38,7 +38,7 @@ function testCwd(options, forCode, forData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assume these exist, and 'pwd' gives us the right directory back
|
// Assume these exist, and 'pwd' gives us the right directory back
|
||||||
if (process.platform == 'win32') {
|
if (common.isWindows) {
|
||||||
testCwd({cwd: process.env.windir}, 0, process.env.windir);
|
testCwd({cwd: process.env.windir}, 0, process.env.windir);
|
||||||
testCwd({cwd: 'c:\\'}, 0, 'c:\\');
|
testCwd({cwd: 'c:\\'}, 0, 'c:\\');
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,11 +4,9 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
|
|
||||||
process.env.HELLO = 'WORLD';
|
process.env.HELLO = 'WORLD';
|
||||||
|
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
var child = spawn('cmd.exe', ['/c', 'set'], {});
|
var child = spawn('cmd.exe', ['/c', 'set'], {});
|
||||||
} else {
|
} else {
|
||||||
var child = spawn('/usr/bin/env', [], {});
|
var child = spawn('/usr/bin/env', [], {});
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var common = require('../common');
|
var common = require('../common');
|
||||||
var assert = require('assert'),
|
var assert = require('assert'),
|
||||||
os = require('os'),
|
os = require('os'),
|
||||||
@ -12,7 +10,7 @@ var assert = require('assert'),
|
|||||||
|
|
||||||
var grep, sed, echo;
|
var grep, sed, echo;
|
||||||
|
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
grep = spawn('grep', ['--binary', 'o']),
|
grep = spawn('grep', ['--binary', 'o']),
|
||||||
sed = spawn('sed', ['--binary', 's/o/O/']),
|
sed = spawn('sed', ['--binary', 's/o/O/']),
|
||||||
echo = spawn('cmd.exe',
|
echo = spawn('cmd.exe',
|
||||||
|
@ -4,8 +4,6 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var env = {
|
var env = {
|
||||||
'HELLO': 'WORLD'
|
'HELLO': 'WORLD'
|
||||||
};
|
};
|
||||||
@ -13,7 +11,7 @@ env.__proto__ = {
|
|||||||
'FOO': 'BAR'
|
'FOO': 'BAR'
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
var child = spawn('cmd.exe', ['/c', 'set'], {env: env});
|
var child = spawn('cmd.exe', ['/c', 'set'], {env: env});
|
||||||
} else {
|
} else {
|
||||||
var child = spawn('/usr/bin/env', [], {env: env});
|
var child = spawn('/usr/bin/env', [], {env: env});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
|
|
||||||
@ -8,7 +8,7 @@ var error_count = 0;
|
|||||||
|
|
||||||
var pwdcommand, dir;
|
var pwdcommand, dir;
|
||||||
|
|
||||||
if (process.platform == 'win32') {
|
if (common.isWindows) {
|
||||||
pwdcommand = 'echo %cd%';
|
pwdcommand = 'echo %cd%';
|
||||||
dir = 'c:\\windows';
|
dir = 'c:\\windows';
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,7 +20,7 @@ function after(err, stdout, stderr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform !== 'win32') {
|
if (!common.isWindows) {
|
||||||
child = exec('/usr/bin/env', { env: { 'HELLO': 'WORLD' } }, after);
|
child = exec('/usr/bin/env', { env: { 'HELLO': 'WORLD' } }, after);
|
||||||
} else {
|
} else {
|
||||||
child = exec('set', { env: { 'HELLO': 'WORLD' } }, after);
|
child = exec('set', { env: { 'HELLO': 'WORLD' } }, after);
|
||||||
|
@ -17,7 +17,7 @@ function test(fun, code) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
test(child_process.exec, 1); // exit code of cmd.exe
|
test(child_process.exec, 1); // exit code of cmd.exe
|
||||||
} else {
|
} else {
|
||||||
test(child_process.exec, 127); // exit code of /bin/sh
|
test(child_process.exec, 127); // exit code of /bin/sh
|
||||||
|
@ -18,7 +18,7 @@ var fork = require('child_process').fork;
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var common = require('../common');
|
var common = require('../common');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.error('Sending dgram sockets to child processes not supported');
|
console.error('Sending dgram sockets to child processes not supported');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,12 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var exitCode;
|
var exitCode;
|
||||||
var termSignal;
|
var termSignal;
|
||||||
var gotStdoutEOF = false;
|
var gotStdoutEOF = false;
|
||||||
var gotStderrEOF = false;
|
var gotStderrEOF = false;
|
||||||
|
|
||||||
var cat = spawn(is_windows ? 'cmd' : 'cat');
|
var cat = spawn(common.isWindows ? 'cmd' : 'cat');
|
||||||
|
|
||||||
|
|
||||||
cat.stdout.on('end', function() {
|
cat.stdout.on('end', function() {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
var spawn = child_process.spawn;
|
var spawn = child_process.spawn;
|
||||||
var cmd = (process.platform === 'win32') ? 'rundll32' : 'ls';
|
var cmd = require('../common').isWindows ? 'rundll32' : 'ls';
|
||||||
var invalidArgsMsg = /Incorrect value of args option/;
|
var invalidArgsMsg = /Incorrect value of args option/;
|
||||||
var invalidOptionsMsg = /options argument must be an object/;
|
var invalidOptionsMsg = /options argument must be an object/;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ assert.deepEqual(ret_err.spawnargs, ['bar']);
|
|||||||
var response;
|
var response;
|
||||||
var cwd;
|
var cwd;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
cwd = 'c:\\';
|
cwd = 'c:\\';
|
||||||
response = spawnSync('cmd.exe', ['/c', 'cd'], {cwd: cwd});
|
response = spawnSync('cmd.exe', ['/c', 'cd'], {cwd: cwd});
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,9 +3,8 @@ var common = require('../common');
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var cat = spawn(is_windows ? 'more' : 'cat');
|
var cat = spawn(common.isWindows ? 'more' : 'cat');
|
||||||
cat.stdin.write('hello');
|
cat.stdin.write('hello');
|
||||||
cat.stdin.write(' ');
|
cat.stdin.write(' ');
|
||||||
cat.stdin.write('world');
|
cat.stdin.write('world');
|
||||||
@ -51,7 +50,7 @@ cat.on('exit', function(status) {
|
|||||||
|
|
||||||
cat.on('close', function() {
|
cat.on('close', function() {
|
||||||
closed = true;
|
closed = true;
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
assert.equal('hello world\r\n', response);
|
assert.equal('hello world\r\n', response);
|
||||||
} else {
|
} else {
|
||||||
assert.equal('hello world', response);
|
assert.equal('hello world', response);
|
||||||
@ -61,7 +60,7 @@ cat.on('close', function() {
|
|||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
assert.equal(0, exitStatus);
|
assert.equal(0, exitStatus);
|
||||||
assert(closed);
|
assert(closed);
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
assert.equal('hello world\r\n', response);
|
assert.equal('hello world\r\n', response);
|
||||||
} else {
|
} else {
|
||||||
assert.equal('hello world', response);
|
assert.equal('hello world', response);
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
var cluster = require('cluster');
|
var cluster = require('cluster');
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: not reliable on Windows.');
|
console.log('1..0 # Skipped: not reliable on Windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ var common = require('../common');
|
|||||||
var dgram = require('dgram');
|
var dgram = require('dgram');
|
||||||
|
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.warn('dgram clustering is currently not supported on windows.');
|
console.warn('dgram clustering is currently not supported on windows.');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ var common = require('../common');
|
|||||||
var dgram = require('dgram');
|
var dgram = require('dgram');
|
||||||
|
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.warn('dgram clustering is currently not supported on windows.');
|
console.warn('dgram clustering is currently not supported on windows.');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
if (process.platform === 'win32') {
|
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: on windows, because clustered dgram is ENOTSUP');
|
console.log('1..0 # Skipped: on windows, because clustered dgram is ENOTSUP');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
const cluster = require('cluster');
|
||||||
|
const http = require('http');
|
||||||
|
|
||||||
// It is not possible to send pipe handles over the IPC pipe on Windows.
|
// It is not possible to send pipe handles over the IPC pipe on Windows.
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var common = require('../common');
|
|
||||||
var assert = require('assert');
|
|
||||||
var cluster = require('cluster');
|
|
||||||
var http = require('http');
|
|
||||||
|
|
||||||
if (cluster.isMaster) {
|
if (cluster.isMaster) {
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
var ok = false;
|
var ok = false;
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
var cluster = require('cluster');
|
var cluster = require('cluster');
|
||||||
var net = require('net');
|
var net = require('net');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: not reliable on Windows');
|
console.log('1..0 # Skipped: not reliable on Windows');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ var fs = require('fs');
|
|||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
// Fails with EINVAL on SmartOS, EBUSY on Windows.
|
// Fails with EINVAL on SmartOS, EBUSY on Windows.
|
||||||
if (process.platform === 'sunos' || process.platform === 'win32') {
|
if (process.platform === 'sunos' || common.isWindows) {
|
||||||
console.log('1..0 # Skipped: cannot rmdir current working directory');
|
console.log('1..0 # Skipped: cannot rmdir current working directory');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ var fs = require('fs');
|
|||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
// Fails with EINVAL on SmartOS, EBUSY on Windows.
|
// Fails with EINVAL on SmartOS, EBUSY on Windows.
|
||||||
if (process.platform === 'sunos' || process.platform === 'win32') {
|
if (process.platform === 'sunos' || common.isWindows) {
|
||||||
console.log('1..0 # Skipped: cannot rmdir current working directory');
|
console.log('1..0 # Skipped: cannot rmdir current working directory');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,6 @@ var dgram = require('dgram');
|
|||||||
// supported while using cluster, though servers still cause the master to error
|
// supported while using cluster, though servers still cause the master to error
|
||||||
// with ENOTSUP.
|
// with ENOTSUP.
|
||||||
|
|
||||||
var windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
if (cluster.isMaster) {
|
if (cluster.isMaster) {
|
||||||
var pass;
|
var pass;
|
||||||
var messages = 0;
|
var messages = 0;
|
||||||
@ -56,12 +54,12 @@ if (cluster.isMaster) {
|
|||||||
messages++;
|
messages++;
|
||||||
ports[rinfo.port] = true;
|
ports[rinfo.port] = true;
|
||||||
|
|
||||||
if (windows && messages === 2) {
|
if (common.isWindows && messages === 2) {
|
||||||
assert.equal(Object.keys(ports).length, 2);
|
assert.equal(Object.keys(ports).length, 2);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!windows && messages === 4) {
|
if (!common.isWindows && messages === 4) {
|
||||||
assert.equal(Object.keys(ports).length, 3);
|
assert.equal(Object.keys(ports).length, 3);
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
@ -76,7 +74,7 @@ if (cluster.isMaster) {
|
|||||||
target.on('listening', function() {
|
target.on('listening', function() {
|
||||||
cluster.fork();
|
cluster.fork();
|
||||||
cluster.fork();
|
cluster.fork();
|
||||||
if (!windows) {
|
if (!common.isWindows) {
|
||||||
cluster.fork({BOUND: 'y'});
|
cluster.fork({BOUND: 'y'});
|
||||||
cluster.fork({BOUND: 'y'});
|
cluster.fork({BOUND: 'y'});
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ createFileWithPerms(readWriteFile, 0o666);
|
|||||||
* continuous integration platform to take care of that.
|
* continuous integration platform to take care of that.
|
||||||
*/
|
*/
|
||||||
var hasWriteAccessForReadonlyFile = false;
|
var hasWriteAccessForReadonlyFile = false;
|
||||||
if (process.platform !== 'win32' && process.getuid() === 0) {
|
if (!common.isWindows && process.getuid() === 0) {
|
||||||
hasWriteAccessForReadonlyFile = true;
|
hasWriteAccessForReadonlyFile = true;
|
||||||
try {
|
try {
|
||||||
process.setuid('nobody');
|
process.setuid('nobody');
|
||||||
|
@ -62,7 +62,7 @@ var m = 0o600;
|
|||||||
fs.appendFileSync(filename4, num, { mode: m });
|
fs.appendFileSync(filename4, num, { mode: m });
|
||||||
|
|
||||||
// windows permissions aren't unix
|
// windows permissions aren't unix
|
||||||
if (process.platform !== 'win32') {
|
if (!common.isWindows) {
|
||||||
var st = fs.statSync(filename4);
|
var st = fs.statSync(filename4);
|
||||||
assert.equal(st.mode & 0o700, m);
|
assert.equal(st.mode & 0o700, m);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ fs.appendFile(filename4, n, { mode: m }, function(e) {
|
|||||||
common.error('appended to file4');
|
common.error('appended to file4');
|
||||||
|
|
||||||
// windows permissions aren't unix
|
// windows permissions aren't unix
|
||||||
if (process.platform !== 'win32') {
|
if (!common.isWindows) {
|
||||||
var st = fs.statSync(filename4);
|
var st = fs.statSync(filename4);
|
||||||
assert.equal(st.mode & 0o700, m);
|
assert.equal(st.mode & 0o700, m);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ var got_error = false;
|
|||||||
var success_count = 0;
|
var success_count = 0;
|
||||||
var mode_async;
|
var mode_async;
|
||||||
var mode_sync;
|
var mode_sync;
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
// Need to hijack fs.open/close to make sure that things
|
// Need to hijack fs.open/close to make sure that things
|
||||||
// get closed once they're opened.
|
// get closed once they're opened.
|
||||||
@ -44,7 +43,7 @@ function closeSync() {
|
|||||||
|
|
||||||
|
|
||||||
// On Windows chmod is only able to manipulate read-only bit
|
// On Windows chmod is only able to manipulate read-only bit
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
mode_async = 0o400; // read-only
|
mode_async = 0o400; // read-only
|
||||||
mode_sync = 0o600; // read-write
|
mode_sync = 0o600; // read-write
|
||||||
} else {
|
} else {
|
||||||
@ -61,14 +60,14 @@ fs.chmod(file1, mode_async.toString(8), function(err) {
|
|||||||
} else {
|
} else {
|
||||||
console.log(fs.statSync(file1).mode);
|
console.log(fs.statSync(file1).mode);
|
||||||
|
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
assert.ok((fs.statSync(file1).mode & 0o777) & mode_async);
|
assert.ok((fs.statSync(file1).mode & 0o777) & mode_async);
|
||||||
} else {
|
} else {
|
||||||
assert.equal(mode_async, fs.statSync(file1).mode & 0o777);
|
assert.equal(mode_async, fs.statSync(file1).mode & 0o777);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.chmodSync(file1, mode_sync);
|
fs.chmodSync(file1, mode_sync);
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
assert.ok((fs.statSync(file1).mode & 0o777) & mode_sync);
|
assert.ok((fs.statSync(file1).mode & 0o777) & mode_sync);
|
||||||
} else {
|
} else {
|
||||||
assert.equal(mode_sync, fs.statSync(file1).mode & 0o777);
|
assert.equal(mode_sync, fs.statSync(file1).mode & 0o777);
|
||||||
@ -89,14 +88,14 @@ fs.open(file2, 'a', function(err, fd) {
|
|||||||
} else {
|
} else {
|
||||||
console.log(fs.fstatSync(fd).mode);
|
console.log(fs.fstatSync(fd).mode);
|
||||||
|
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async);
|
assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async);
|
||||||
} else {
|
} else {
|
||||||
assert.equal(mode_async, fs.fstatSync(fd).mode & 0o777);
|
assert.equal(mode_async, fs.fstatSync(fd).mode & 0o777);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.fchmodSync(fd, mode_sync);
|
fs.fchmodSync(fd, mode_sync);
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_sync);
|
assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_sync);
|
||||||
} else {
|
} else {
|
||||||
assert.equal(mode_sync, fs.fstatSync(fd).mode & 0o777);
|
assert.equal(mode_sync, fs.fstatSync(fd).mode & 0o777);
|
||||||
|
@ -5,7 +5,7 @@ var path = require('path');
|
|||||||
|
|
||||||
// simulate `cat readfile.js | node readfile.js`
|
// simulate `cat readfile.js | node readfile.js`
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: No /dev/stdin on windows.');
|
console.log('1..0 # Skipped: No /dev/stdin on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
|
|
||||||
// simulate `cat readfile.js | node readfile.js`
|
// simulate `cat readfile.js | node readfile.js`
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: No /dev/stdin on windows.');
|
console.log('1..0 # Skipped: No /dev/stdin on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ var path = require('path');
|
|||||||
|
|
||||||
// simulate `cat readfile.js | node readfile.js`
|
// simulate `cat readfile.js | node readfile.js`
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: No /dev/stdin on windows.');
|
console.log('1..0 # Skipped: No /dev/stdin on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,12 @@ var fs = require('fs');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
var async_completed = 0, async_expected = 0, unlink = [];
|
var async_completed = 0, async_expected = 0, unlink = [];
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
var skipSymlinks = false;
|
var skipSymlinks = false;
|
||||||
|
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
|
||||||
var root = '/';
|
var root = '/';
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
// something like "C:\\"
|
// something like "C:\\"
|
||||||
root = process.cwd().substr(0, 3);
|
root = process.cwd().substr(0, 3);
|
||||||
|
|
||||||
@ -292,7 +291,7 @@ function test_relative_input_cwd(callback) {
|
|||||||
|
|
||||||
function test_deep_symlink_mix(callback) {
|
function test_deep_symlink_mix(callback) {
|
||||||
console.log('test_deep_symlink_mix');
|
console.log('test_deep_symlink_mix');
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
// This one is a mix of files and directories, and it's quite tricky
|
// This one is a mix of files and directories, and it's quite tricky
|
||||||
// to get the file/dir links sorted out correctly.
|
// to get the file/dir links sorted out correctly.
|
||||||
console.log('1..0 # Skipped: symlink test (no privs)');
|
console.log('1..0 # Skipped: symlink test (no privs)');
|
||||||
@ -503,7 +502,7 @@ function test_lying_cache_liar(cb) {
|
|||||||
'/a/b' : '/a/b',
|
'/a/b' : '/a/b',
|
||||||
'/a/b/c' : '/a/b',
|
'/a/b/c' : '/a/b',
|
||||||
'/a/b/d' : '/a/b/d' };
|
'/a/b/d' : '/a/b/d' };
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
var wc = {};
|
var wc = {};
|
||||||
Object.keys(cache).forEach(function(k) {
|
Object.keys(cache).forEach(function(k) {
|
||||||
wc[ path.resolve(k) ] = path.resolve(cache[k]);
|
wc[ path.resolve(k) ] = path.resolve(cache[k]);
|
||||||
|
@ -9,8 +9,6 @@ var expected_async = 4;
|
|||||||
var linkTime;
|
var linkTime;
|
||||||
var fileTime;
|
var fileTime;
|
||||||
|
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
|
|
||||||
var runtest = function(skip_symlinks) {
|
var runtest = function(skip_symlinks) {
|
||||||
@ -57,7 +55,7 @@ var runtest = function(skip_symlinks) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
// On Windows, creating symlinks requires admin privileges.
|
// On Windows, creating symlinks requires admin privileges.
|
||||||
// We'll only try to run symlink test if we have enough privileges.
|
// We'll only try to run symlink test if we have enough privileges.
|
||||||
exec('whoami /priv', function(err, o) {
|
exec('whoami /priv', function(err, o) {
|
||||||
|
@ -4,8 +4,6 @@ var assert = require('assert');
|
|||||||
var util = require('util');
|
var util = require('util');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var tests_ok = 0;
|
var tests_ok = 0;
|
||||||
var tests_run = 0;
|
var tests_run = 0;
|
||||||
|
|
||||||
@ -99,7 +97,7 @@ function runTest(atime, mtime, callback) {
|
|||||||
expect_errno('utimes', 'foobarbaz', err, 'ENOENT');
|
expect_errno('utimes', 'foobarbaz', err, 'ENOENT');
|
||||||
|
|
||||||
// don't close this fd
|
// don't close this fd
|
||||||
if (is_windows) {
|
if (common.isWindows) {
|
||||||
fd = fs.openSync(__filename, 'r+');
|
fd = fs.openSync(__filename, 'r+');
|
||||||
} else {
|
} else {
|
||||||
fd = fs.openSync(__filename, 'r');
|
fd = fs.openSync(__filename, 'r');
|
||||||
|
@ -3,7 +3,6 @@ var common = require('../common');
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
var openCount = 0;
|
var openCount = 0;
|
||||||
var mode;
|
var mode;
|
||||||
var content;
|
var content;
|
||||||
@ -20,7 +19,7 @@ var mask = process.umask(0o000);
|
|||||||
|
|
||||||
// On Windows chmod is only able to manipulate read-only bit. Test if creating
|
// On Windows chmod is only able to manipulate read-only bit. Test if creating
|
||||||
// the file in read-only mode works.
|
// the file in read-only mode works.
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
mode = 0o444;
|
mode = 0o444;
|
||||||
} else {
|
} else {
|
||||||
mode = 0o755;
|
mode = 0o755;
|
||||||
|
@ -63,7 +63,7 @@ fs.writeFile(filename3, n, { mode: m }, function(e) {
|
|||||||
if (e) throw e;
|
if (e) throw e;
|
||||||
|
|
||||||
// windows permissions aren't unix
|
// windows permissions aren't unix
|
||||||
if (process.platform !== 'win32') {
|
if (!common.isWindows) {
|
||||||
var st = fs.statSync(filename3);
|
var st = fs.statSync(filename3);
|
||||||
assert.equal(st.mode & 0o700, m);
|
assert.equal(st.mode & 0o700, m);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ server.listen(common.PORT, function() {
|
|||||||
'-key', join(common.fixturesDir, 'foafssl.key')];
|
'-key', join(common.fixturesDir, 'foafssl.key')];
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
var client = spawn(common.opensslCli, args);
|
var client = spawn(common.opensslCli, args);
|
||||||
|
@ -9,7 +9,7 @@ var cluster = require('cluster');
|
|||||||
|
|
||||||
console.error('Cluster listen fd test', process.argv.slice(2));
|
console.error('Cluster listen fd test', process.argv.slice(2));
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: This test is disabled on windows.');
|
console.log('1..0 # Skipped: This test is disabled on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ var net = require('net');
|
|||||||
var PORT = common.PORT;
|
var PORT = common.PORT;
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: This test is disabled on windows.');
|
console.log('1..0 # Skipped: This test is disabled on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ var net = require('net');
|
|||||||
var PORT = common.PORT;
|
var PORT = common.PORT;
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: This test is disabled on windows.');
|
console.log('1..0 # Skipped: This test is disabled on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ var net = require('net');
|
|||||||
var PORT = common.PORT;
|
var PORT = common.PORT;
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: This test is disabled on windows.');
|
console.log('1..0 # Skipped: This test is disabled on windows.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,10 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var module = require('module');
|
var module = require('module');
|
||||||
|
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var partA, partB;
|
var partA, partB;
|
||||||
var partC = '';
|
var partC = '';
|
||||||
|
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
partA = 'C:\\Users\\Rocko Artischocko\\AppData\\Roaming\\npm';
|
partA = 'C:\\Users\\Rocko Artischocko\\AppData\\Roaming\\npm';
|
||||||
partB = 'C:\\Program Files (x86)\\nodejs\\';
|
partB = 'C:\\Program Files (x86)\\nodejs\\';
|
||||||
process.env['NODE_PATH'] = partA + ';' + partB + ';' + partC;
|
process.env['NODE_PATH'] = partA + ';' + partB + ';' + partC;
|
||||||
|
@ -4,11 +4,9 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var module = require('module');
|
var module = require('module');
|
||||||
|
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var file, delimiter, paths;
|
var file, delimiter, paths;
|
||||||
|
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
file = 'C:\\Users\\Rocko Artischocko\\node_stuff\\foo';
|
file = 'C:\\Users\\Rocko Artischocko\\node_stuff\\foo';
|
||||||
delimiter = '\\';
|
delimiter = '\\';
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,7 +14,7 @@ var accessErrorFired = false;
|
|||||||
|
|
||||||
var emptyTxt;
|
var emptyTxt;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
// on Win, common.PIPE will be a named pipe, so we use an existing empty
|
// on Win, common.PIPE will be a named pipe, so we use an existing empty
|
||||||
// file instead
|
// file instead
|
||||||
emptyTxt = path.join(common.fixturesDir, 'empty.txt');
|
emptyTxt = path.join(common.fixturesDir, 'empty.txt');
|
||||||
@ -58,7 +58,7 @@ noEntSocketClient.on('error', function(err) {
|
|||||||
|
|
||||||
|
|
||||||
// On Windows or when running as root, a chmod has no effect on named pipes
|
// On Windows or when running as root, a chmod has no effect on named pipes
|
||||||
if (process.platform !== 'win32' && process.getuid() !== 0) {
|
if (!common.isWindows && process.getuid() !== 0) {
|
||||||
// Trying to connect to a socket one has no access to should result in EACCES
|
// Trying to connect to a socket one has no access to should result in EACCES
|
||||||
var accessServer = net.createServer(function() {
|
var accessServer = net.createServer(function() {
|
||||||
assert.ok(false);
|
assert.ok(false);
|
||||||
@ -83,7 +83,7 @@ if (process.platform !== 'win32' && process.getuid() !== 0) {
|
|||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
assert.ok(notSocketErrorFired);
|
assert.ok(notSocketErrorFired);
|
||||||
assert.ok(noEntErrorFired);
|
assert.ok(noEntErrorFired);
|
||||||
if (process.platform !== 'win32' && process.getuid() !== 0) {
|
if (!common.isWindows && process.getuid() !== 0) {
|
||||||
assert.ok(accessErrorFired);
|
assert.ok(accessErrorFired);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,7 @@ var assert = require('assert');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var common = require('../common');
|
var common = require('../common');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
var file = path.join(common.fixturesDir, 'a.js');
|
var file = path.join(common.fixturesDir, 'a.js');
|
||||||
var resolvedFile = path.resolve(file);
|
var resolvedFile = path.resolve(file);
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var isWindows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var f = __filename;
|
var f = __filename;
|
||||||
|
|
||||||
assert.equal(path.basename(f), 'test-path.js');
|
assert.equal(path.basename(f), 'test-path.js');
|
||||||
@ -33,7 +31,7 @@ assert.equal(path.posix.basename('basename.ext\\\\'), 'basename.ext\\\\');
|
|||||||
|
|
||||||
// POSIX filenames may include control characters
|
// POSIX filenames may include control characters
|
||||||
// c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
|
// c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html
|
||||||
if (!isWindows) {
|
if (!common.isWindows) {
|
||||||
var controlCharFilename = 'Icon' + String.fromCharCode(13);
|
var controlCharFilename = 'Icon' + String.fromCharCode(13);
|
||||||
assert.equal(path.basename('/a/b/' + controlCharFilename),
|
assert.equal(path.basename('/a/b/' + controlCharFilename),
|
||||||
controlCharFilename);
|
controlCharFilename);
|
||||||
@ -42,7 +40,7 @@ if (!isWindows) {
|
|||||||
assert.equal(path.extname(f), '.js');
|
assert.equal(path.extname(f), '.js');
|
||||||
|
|
||||||
assert.equal(path.dirname(f).substr(-13),
|
assert.equal(path.dirname(f).substr(-13),
|
||||||
isWindows ? 'test\\parallel' : 'test/parallel');
|
common.isWindows ? 'test\\parallel' : 'test/parallel');
|
||||||
assert.equal(path.dirname('/a/b/'), '/a');
|
assert.equal(path.dirname('/a/b/'), '/a');
|
||||||
assert.equal(path.dirname('/a/b'), '/a');
|
assert.equal(path.dirname('/a/b'), '/a');
|
||||||
assert.equal(path.dirname('/a'), '/');
|
assert.equal(path.dirname('/a'), '/');
|
||||||
@ -194,7 +192,7 @@ var joinTests =
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Windows-specific join tests
|
// Windows-specific join tests
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
joinTests = joinTests.concat(
|
joinTests = joinTests.concat(
|
||||||
[// UNC path expected
|
[// UNC path expected
|
||||||
[['//foo/bar'], '//foo/bar/'],
|
[['//foo/bar'], '//foo/bar/'],
|
||||||
@ -246,7 +244,7 @@ if (isWindows) {
|
|||||||
// Run the join tests.
|
// Run the join tests.
|
||||||
joinTests.forEach(function(test) {
|
joinTests.forEach(function(test) {
|
||||||
var actual = path.join.apply(path, test[0]);
|
var actual = path.join.apply(path, test[0]);
|
||||||
var expected = isWindows ? test[1].replace(/\//g, '\\') : test[1];
|
var expected = common.isWindows ? test[1].replace(/\//g, '\\') : test[1];
|
||||||
var message = 'path.join(' + test[0].map(JSON.stringify).join(',') + ')' +
|
var message = 'path.join(' + test[0].map(JSON.stringify).join(',') + ')' +
|
||||||
'\n expect=' + JSON.stringify(expected) +
|
'\n expect=' + JSON.stringify(expected) +
|
||||||
'\n actual=' + JSON.stringify(actual);
|
'\n actual=' + JSON.stringify(actual);
|
||||||
@ -306,7 +304,7 @@ assert.equal(path.posix.normalize('a//b//./c'), 'a/b/c');
|
|||||||
assert.equal(path.posix.normalize('a//b//.'), 'a/b');
|
assert.equal(path.posix.normalize('a//b//.'), 'a/b');
|
||||||
|
|
||||||
// path.resolve tests
|
// path.resolve tests
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
// windows
|
// windows
|
||||||
var resolveTests =
|
var resolveTests =
|
||||||
// arguments result
|
// arguments result
|
||||||
@ -360,7 +358,7 @@ assert.equal(path.posix.isAbsolute('bar/'), false);
|
|||||||
assert.equal(path.posix.isAbsolute('./baz'), false);
|
assert.equal(path.posix.isAbsolute('./baz'), false);
|
||||||
|
|
||||||
// path.relative tests
|
// path.relative tests
|
||||||
if (isWindows) {
|
if (common.isWindows) {
|
||||||
// windows
|
// windows
|
||||||
var relativeTests =
|
var relativeTests =
|
||||||
// arguments result
|
// arguments result
|
||||||
@ -409,7 +407,7 @@ assert.equal(path.win32.delimiter, ';');
|
|||||||
assert.equal(path.posix.delimiter, ':');
|
assert.equal(path.posix.delimiter, ':');
|
||||||
|
|
||||||
|
|
||||||
if (isWindows)
|
if (common.isWindows)
|
||||||
assert.deepEqual(path, path.win32, 'should be win32 path module');
|
assert.deepEqual(path, path.win32, 'should be win32 path module');
|
||||||
else
|
else
|
||||||
assert.deepEqual(path, path.posix, 'should be posix path module');
|
assert.deepEqual(path, path.posix, 'should be posix path module');
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
if (process.platform === 'win32') {
|
|
||||||
|
const assert = require('assert');
|
||||||
|
const spawn = require('child_process').spawn;
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
if (common.isWindows) {
|
||||||
// Win32 doesn't have signals, just a kindof emulation, insufficient
|
// Win32 doesn't have signals, just a kindof emulation, insufficient
|
||||||
// for this test to apply.
|
// for this test to apply.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var assert = require('assert');
|
|
||||||
var spawn = require('child_process').spawn;
|
|
||||||
var ok;
|
var ok;
|
||||||
|
|
||||||
if (process.argv[2] !== '--do-test') {
|
if (process.argv[2] !== '--do-test') {
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
// SIGUSR1 and SIGHUP are not supported on Windows
|
// SIGUSR1 and SIGHUP are not supported on Windows
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var common = require('../common');
|
|
||||||
var assert = require('assert');
|
|
||||||
|
|
||||||
console.log('process.pid: ' + process.pid);
|
console.log('process.pid: ' + process.pid);
|
||||||
|
|
||||||
var first = 0,
|
var first = 0,
|
||||||
|
@ -3,7 +3,7 @@ var common = require('../common');
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: platform not supported.');
|
console.log('1..0 # Skipped: platform not supported.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ var server = tls.Server({
|
|||||||
'-connect', '127.0.0.1:' + common.PORT];
|
'-connect', '127.0.0.1:' + common.PORT];
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
var client = spawn(common.opensslCli, args);
|
var client = spawn(common.opensslCli, args);
|
||||||
|
@ -45,7 +45,7 @@ function test(keylen, expectedCipher, cb) {
|
|||||||
'-cipher', ciphers];
|
'-cipher', ciphers];
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
var client = spawn(common.opensslCli, args);
|
var client = spawn(common.opensslCli, args);
|
||||||
|
@ -34,7 +34,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
|
|||||||
' -connect 127.0.0.1:' + common.PORT;
|
' -connect 127.0.0.1:' + common.PORT;
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
cmd += ' -no_rand_screen';
|
cmd += ' -no_rand_screen';
|
||||||
|
|
||||||
exec(cmd, function(err, stdout, stderr) {
|
exec(cmd, function(err, stdout, stderr) {
|
||||||
|
@ -37,7 +37,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
|
|||||||
' -connect 127.0.0.1:' + common.PORT;
|
' -connect 127.0.0.1:' + common.PORT;
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
cmd += ' -no_rand_screen';
|
cmd += ' -no_rand_screen';
|
||||||
|
|
||||||
exec(cmd, function(err, stdout, stderr) {
|
exec(cmd, function(err, stdout, stderr) {
|
||||||
|
@ -31,7 +31,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
|
|||||||
'-connect', address];
|
'-connect', address];
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
var client = spawn(common.opensslCli, args, { stdio: 'inherit' });
|
var client = spawn(common.opensslCli, args, { stdio: 'inherit' });
|
||||||
|
@ -97,7 +97,7 @@ server.listen(common.PORT, function() {
|
|||||||
var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT];
|
var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT];
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
var client = spawn(common.opensslCli, args);
|
var client = spawn(common.opensslCli, args);
|
||||||
|
@ -135,7 +135,7 @@ function runClient(prefix, port, options, cb) {
|
|||||||
var args = ['s_client', '-connect', '127.0.0.1:' + port];
|
var args = ['s_client', '-connect', '127.0.0.1:' + port];
|
||||||
|
|
||||||
// for the performance issue in s_client on Windows
|
// for the performance issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
console.log(prefix + ' connecting with', options.name);
|
console.log(prefix + ' connecting with', options.name);
|
||||||
|
@ -82,7 +82,7 @@ function doTest(testOptions, callback) {
|
|||||||
].concat(testOptions.tickets ? [] : '-no_ticket');
|
].concat(testOptions.tickets ? [] : '-no_ticket');
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
args.push('-no_rand_screen');
|
args.push('-no_rand_screen');
|
||||||
|
|
||||||
server.listen(common.PORT, function() {
|
server.listen(common.PORT, function() {
|
||||||
|
@ -41,7 +41,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
|
|||||||
' -connect 127.0.0.1:' + common.PORT;
|
' -connect 127.0.0.1:' + common.PORT;
|
||||||
|
|
||||||
// for the performance and stability issue in s_client on Windows
|
// for the performance and stability issue in s_client on Windows
|
||||||
if (process.platform === 'win32')
|
if (common.isWindows)
|
||||||
cmd += ' -no_rand_screen';
|
cmd += ' -no_rand_screen';
|
||||||
|
|
||||||
exec(cmd, function(err, stdout, stderr) {
|
exec(cmd, function(err, stdout, stderr) {
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
|
|
||||||
// Note in Windows one can only set the "user" bits.
|
// Note in Windows one can only set the "user" bits.
|
||||||
var mask;
|
var mask;
|
||||||
if (process.platform == 'win32') {
|
if (common.isWindows) {
|
||||||
mask = '0600';
|
mask = '0600';
|
||||||
} else {
|
} else {
|
||||||
mask = '0664';
|
mask = '0664';
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var common = require('../common');
|
var common = require('../common');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows');
|
console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@ var assert = require('assert');
|
|||||||
|
|
||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
var is_windows = process.platform === 'win32';
|
|
||||||
|
|
||||||
var SIZE = 1000 * 1024;
|
var SIZE = 1000 * 1024;
|
||||||
var N = 40;
|
var N = 40;
|
||||||
var finished = false;
|
var finished = false;
|
||||||
@ -25,7 +23,7 @@ function doSpawn(i) {
|
|||||||
|
|
||||||
child.on('close', function() {
|
child.on('close', function() {
|
||||||
// + 1 for \n or + 2 for \r\n on Windows
|
// + 1 for \n or + 2 for \r\n on Windows
|
||||||
assert.equal(SIZE + (is_windows ? 2 : 1), count);
|
assert.equal(SIZE + (common.isWindows ? 2 : 1), count);
|
||||||
if (i < N) {
|
if (i < N) {
|
||||||
doSpawn(i + 1);
|
doSpawn(i + 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,7 +3,7 @@ var common = require('../common');
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
|
|
||||||
if (process.platform !== 'win32') {
|
if (!common.isWindows) {
|
||||||
// Unix.
|
// Unix.
|
||||||
var SLEEP3_COMMAND = 'sleep 3';
|
var SLEEP3_COMMAND = 'sleep 3';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: no `wrk` on windows');
|
console.log('1..0 # Skipped: no `wrk` on windows');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
var spawn = require('child_process').spawn;
|
var spawn = require('child_process').spawn;
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows');
|
console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ assert.strictEqual(ret, msg + '\n',
|
|||||||
var response;
|
var response;
|
||||||
var cwd;
|
var cwd;
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (common.isWindows) {
|
||||||
cwd = 'c:\\';
|
cwd = 'c:\\';
|
||||||
response = execSync('echo %cd%', {cwd: cwd});
|
response = execSync('echo %cd%', {cwd: cwd});
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,7 @@ var assert = require('assert');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var expectFilePath = process.platform === 'win32' ||
|
var expectFilePath = common.isWindows ||
|
||||||
process.platform === 'linux' ||
|
process.platform === 'linux' ||
|
||||||
process.platform === 'darwin';
|
process.platform === 'darwin';
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
// This test is only relevant on Windows.
|
|
||||||
if (process.platform !== 'win32') {
|
|
||||||
return process.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var common = require('../common'),
|
var common = require('../common'),
|
||||||
assert = require('assert'),
|
assert = require('assert'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
succeeded = 0;
|
succeeded = 0;
|
||||||
|
|
||||||
|
// This test is only relevant on Windows.
|
||||||
|
if (!common.isWindows) {
|
||||||
|
return process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
function test(p) {
|
function test(p) {
|
||||||
var result = fs.realpathSync(p);
|
var result = fs.realpathSync(p);
|
||||||
assert.strictEqual(result, path.resolve(p));
|
assert.strictEqual(result, path.resolve(p));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user