Browse Source

Remove tests relying on !process.features.uv

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
9631e29933
  1. 13
      test/internet/test-dns.js
  2. 85
      test/simple/test-child-process-deprecated-api.js
  3. 85
      test/simple/test-module-load-list.js

13
test/internet/test-dns.js

@ -24,8 +24,7 @@ var assert = require('assert'),
net = require('net_uv'), net = require('net_uv'),
isIP = net.isIP, isIP = net.isIP,
isIPv4 = net.isIPv4, isIPv4 = net.isIPv4,
isIPv6 = net.isIPv6, isIPv6 = net.isIPv6;
uv = process.features.uv;
var expected = 0, var expected = 0,
completed = 0, completed = 0,
@ -59,16 +58,14 @@ function TEST(f) {
process.on('exit', function() { process.on('exit', function() {
console.log(completed + ' tests completed (using libuv: ' + (!!uv) + ')'); console.log(completed + ' tests completed');
assert.equal(running, false); assert.equal(running, false);
assert.strictEqual(expected, completed); assert.strictEqual(expected, completed);
}); });
function checkWrap(req) { function checkWrap(req) {
if (uv) { assert.ok(typeof req === 'object');
assert.ok(typeof req === 'object');
}
} }
@ -154,7 +151,7 @@ TEST(function test_reverse_bogus(done) {
} }
assert.ok(error instanceof Error); assert.ok(error instanceof Error);
uv && assert.strictEqual(error.errno, 'ENOTIMP'); assert.strictEqual(error.errno, 'ENOTIMP');
done(); done();
}); });
@ -316,7 +313,7 @@ TEST(function test_lookup_failure(done) {
var req = dns.lookup('does.not.exist', 4, function(err, ip, family) { var req = dns.lookup('does.not.exist', 4, function(err, ip, family) {
assert.ok(err instanceof Error); assert.ok(err instanceof Error);
assert.strictEqual(err.errno, dns.NOTFOUND); assert.strictEqual(err.errno, dns.NOTFOUND);
uv && assert.strictEqual(err.errno, 'ENOTFOUND'); assert.strictEqual(err.errno, 'ENOTFOUND');
done(); done();
}); });

85
test/simple/test-child-process-deprecated-api.js

@ -1,85 +0,0 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// We do not support this API with the libuv backend.
if (process.features.uv) return;
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');
var exits = 0;
// Test `env` parameter
// for child_process.spawn(path, args, env, customFds) deprecated api
(function() {
var response = '';
var child = spawn('/usr/bin/env', [], {'HELLO': 'WORLD'});
child.stdout.setEncoding('utf8');
child.stdout.addListener('data', function(chunk) {
response += chunk;
});
process.addListener('exit', function() {
assert.ok(response.indexOf('HELLO=WORLD') >= 0);
exits++;
});
})();
// Test `customFds` parameter
// for child_process.spawn(path, args, env, customFds) deprecated api
(function() {
var expected = 'hello world';
var helloPath = path.join(common.tmpDir, 'hello.txt');
fs.open(helloPath, 'w', 400, function(err, fd) {
if (err) throw err;
var child = spawn('/bin/echo', [expected], undefined, [-1, fd]);
assert.notEqual(child.stdin, null);
assert.equal(child.stdout, null);
assert.notEqual(child.stderr, null);
child.addListener('exit', function(err) {
if (err) throw err;
fs.close(fd, function(err) {
if (err) throw err;
fs.readFile(helloPath, function(err, data) {
if (err) throw err;
assert.equal(data.toString(), expected + '\n');
exits++;
});
});
});
});
})();
// Check if all child processes exited
process.addListener('exit', function() {
assert.equal(2, exits);
});

85
test/simple/test-module-load-list.js

@ -64,60 +64,43 @@ checkExpected();
console.log('load console.log. process.stdout._type is ' + console.log('load console.log. process.stdout._type is ' +
process.stdout._type); process.stdout._type);
if (!process.features.uv) { switch (process.stdout._type) {
// legacy case 'fs':
expected = expected.concat([ expected = expected.concat([
'NativeModule console', 'NativeModule console',
'NativeModule net_legacy', 'Binding stdio',
'NativeModule timers_legacy', 'Binding tty_wrap'
'Binding timer', ]);
'NativeModule _linklist', break;
'Binding net',
'NativeModule freelist',
'Binding io_watcher',
'NativeModule tty',
'NativeModule tty_posix',
'NativeModule readline'
]);
} else {
switch (process.stdout._type) {
case 'fs':
expected = expected.concat([
'NativeModule console',
'Binding stdio',
'Binding tty_wrap'
]);
break;
case 'tty': case 'tty':
expected = expected.concat([ expected = expected.concat([
'NativeModule console', 'NativeModule console',
'Binding stdio', 'Binding stdio',
'Binding tty_wrap', 'Binding tty_wrap',
'NativeModule tty_uv', 'NativeModule tty_uv',
'NativeModule net_uv', 'NativeModule net_uv',
'NativeModule timers_uv', 'NativeModule timers_uv',
'Binding timer_wrap', 'Binding timer_wrap',
'NativeModule _linklist' 'NativeModule _linklist'
]); ]);
break; break;
case 'pipe': case 'pipe':
expected = expected.concat([ expected = expected.concat([
'NativeModule console', 'NativeModule console',
'Binding stdio', 'Binding stdio',
'Binding tty_wrap', 'Binding tty_wrap',
'NativeModule net_uv', 'NativeModule net_uv',
'NativeModule timers_uv', 'NativeModule timers_uv',
'Binding timer_wrap', 'Binding timer_wrap',
'NativeModule _linklist', 'NativeModule _linklist',
'Binding pipe_wrap' 'Binding pipe_wrap'
]); ]);
break; break;
default: default:
assert.ok(0, 'prcoess.stdout._type is bad'); assert.ok(0, 'prcoess.stdout._type is bad');
}
} }
console.error('process.moduleLoadList', process.moduleLoadList); console.error('process.moduleLoadList', process.moduleLoadList);

Loading…
Cancel
Save