From c6b09606aaf7e14ad4ecc0abf7f25d107f52bba2 Mon Sep 17 00:00:00 2001
From: Tomas Hrcka <thrcka@redhat.com>
Date: Thu, 19 Mar 2015 09:49:41 +0100
Subject: [PATCH] Disable some tests
---
.../disabled/koji/test-child-process-fork-dgram.js | 122 +++++++++++
test/disabled/koji/test-crypto-dh-odd-key.js | 31 +++
test/disabled/koji/test-crypto-stream.js | 76 +++++++
test/disabled/koji/test-debugger-client.js | 232 ++++++++++++++++++++
test/disabled/koji/test-debugger-repl-utf8.js | 27 +++
test/disabled/koji/test-debugger-repl.js | 77 +++++++
.../koji/test-dgram-broadcast-multi-process.js | 240 +++++++++++++++++++++
test/disabled/koji/test-fs-readfile-error.js | 64 ++++++
test/disabled/koji/test-http-curl-chunk-problem.js | 85 ++++++++
.../koji/test-http-many-keep-alive-connections.js | 69 ++++++
test/disabled/koji/test-net-GH-5504.js | 123 +++++++++++
test/disabled/koji/test-setproctitle.js | 52 +++++
test/disabled/koji/test-stdout-close-unref.js | 24 +++
test/disabled/koji/test-timers-ordering.js | 48 +++++
test/disabled/koji/test-tls-securepair-client.js | 201 +++++++++++++++++
test/disabled/koji/test-tls-securepair-server.js | 154 +++++++++++++
test/disabled/koji/test-tls-set-ciphers.js | 62 ++++++
test/simple/test-child-process-fork-dgram.js | 122 -----------
test/simple/test-crypto-dh-odd-key.js | 31 ---
test/simple/test-crypto-stream.js | 76 -------
test/simple/test-debugger-client.js | 232 --------------------
test/simple/test-debugger-repl-utf8.js | 27 ---
test/simple/test-debugger-repl.js | 77 -------
test/simple/test-dgram-broadcast-multi-process.js | 240 ---------------------
test/simple/test-fs-readfile-error.js | 64 ------
test/simple/test-http-curl-chunk-problem.js | 85 --------
.../test-http-many-keep-alive-connections.js | 69 ------
test/simple/test-net-GH-5504.js | 123 -----------
test/simple/test-setproctitle.js | 52 -----
test/simple/test-stdout-close-unref.js | 24 ---
test/simple/test-timers-ordering.js | 48 -----
test/simple/test-tls-securepair-client.js | 201 -----------------
test/simple/test-tls-securepair-server.js | 154 -------------
test/simple/test-tls-set-ciphers.js | 62 ------
34 files changed, 1687 insertions(+), 1687 deletions(-)
create mode 100644 test/disabled/koji/test-child-process-fork-dgram.js
create mode 100644 test/disabled/koji/test-crypto-dh-odd-key.js
create mode 100644 test/disabled/koji/test-crypto-stream.js
create mode 100644 test/disabled/koji/test-debugger-client.js
create mode 100644 test/disabled/koji/test-debugger-repl-utf8.js
create mode 100644 test/disabled/koji/test-debugger-repl.js
create mode 100644 test/disabled/koji/test-dgram-broadcast-multi-process.js
create mode 100644 test/disabled/koji/test-fs-readfile-error.js
create mode 100644 test/disabled/koji/test-http-curl-chunk-problem.js
create mode 100644 test/disabled/koji/test-http-many-keep-alive-connections.js
create mode 100644 test/disabled/koji/test-net-GH-5504.js
create mode 100644 test/disabled/koji/test-setproctitle.js
create mode 100644 test/disabled/koji/test-stdout-close-unref.js
create mode 100644 test/disabled/koji/test-timers-ordering.js
create mode 100644 test/disabled/koji/test-tls-securepair-client.js
create mode 100644 test/disabled/koji/test-tls-securepair-server.js
create mode 100644 test/disabled/koji/test-tls-set-ciphers.js
delete mode 100644 test/simple/test-child-process-fork-dgram.js
delete mode 100644 test/simple/test-crypto-dh-odd-key.js
delete mode 100644 test/simple/test-crypto-stream.js
delete mode 100644 test/simple/test-debugger-client.js
delete mode 100644 test/simple/test-debugger-repl-utf8.js
delete mode 100644 test/simple/test-debugger-repl.js
delete mode 100644 test/simple/test-dgram-broadcast-multi-process.js
delete mode 100644 test/simple/test-fs-readfile-error.js
delete mode 100644 test/simple/test-http-curl-chunk-problem.js
delete mode 100644 test/simple/test-http-many-keep-alive-connections.js
delete mode 100644 test/simple/test-net-GH-5504.js
delete mode 100644 test/simple/test-setproctitle.js
delete mode 100644 test/simple/test-stdout-close-unref.js
delete mode 100644 test/simple/test-timers-ordering.js
delete mode 100644 test/simple/test-tls-securepair-client.js
delete mode 100644 test/simple/test-tls-securepair-server.js
delete mode 100644 test/simple/test-tls-set-ciphers.js
diff --git a/test/disabled/koji/test-child-process-fork-dgram.js b/test/disabled/koji/test-child-process-fork-dgram.js
new file mode 100644
index 0000000..1c4e9ac
--- /dev/null
+++ b/test/disabled/koji/test-child-process-fork-dgram.js
@@ -0,0 +1,122 @@
+// 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.
+
+/*
+ * The purpose of this test is to make sure that when forking a process,
+ * sending a fd representing a UDP socket to the child and sending messages
+ * to this endpoint, these messages are distributed to the parent and the
+ * child process.
+ *
+ * Because it's not really possible to predict how the messages will be
+ * distributed among the parent and the child processes, we keep sending
+ * messages until both the parent and the child received at least one
+ * message. The worst case scenario is when either one never receives
+ * a message. In this case the test runner will timeout after 60 secs
+ * and the test will fail.
+ */
+
+var dgram = require('dgram');
+var fork = require('child_process').fork;
+var assert = require('assert');
+var common = require('../common');
+
+if (process.platform === 'win32') {
+ console.error('Sending dgram sockets to child processes not supported');
+ process.exit(0);
+}
+
+if (process.argv[2] === 'child') {
+ var childCollected = 0;
+ var server;
+
+ process.on('message', function removeMe(msg, clusterServer) {
+ if (msg === 'server') {
+ server = clusterServer;
+
+ server.on('message', function () {
+ process.send('gotMessage');
+ });
+
+ } else if (msg === 'stop') {
+ server.close();
+ process.removeListener('message', removeMe);
+ }
+ });
+
+} else {
+ var server = dgram.createSocket('udp4');
+ var client = dgram.createSocket('udp4');
+ var child = fork(__filename, ['child']);
+
+ var msg = new Buffer('Some bytes');
+
+ var childGotMessage = false;
+ var parentGotMessage = false;
+
+ server.on('message', function (msg, rinfo) {
+ parentGotMessage = true;
+ });
+
+ server.on('listening', function () {
+ child.send('server', server);
+
+ child.once('message', function (msg) {
+ if (msg === 'gotMessage') {
+ childGotMessage = true;
+ }
+ });
+
+ sendMessages();
+ });
+
+ var sendMessages = function () {
+ var timer = setInterval(function () {
+ client.send(msg, 0, msg.length, common.PORT, '127.0.0.1', function(err) {
+ if (err) throw err;
+ }
+ );
+
+ /*
+ * Both the parent and the child got at least one message,
+ * test passed, clean up everyting.
+ */
+ if (parentGotMessage && childGotMessage) {
+ clearInterval(timer);
+ shutdown();
+ }
+
+ }, 1);
+ };
+
+ var shutdown = function () {
+ child.send('stop');
+
+ server.close();
+ client.close();
+ };
+
+ server.bind(common.PORT, '127.0.0.1');
+
+ process.once('exit', function () {
+ assert(parentGotMessage);
+ assert(childGotMessage);
+ });
+}
diff --git a/test/disabled/koji/test-crypto-dh-odd-key.js b/test/disabled/koji/test-crypto-dh-odd-key.js
new file mode 100644
index 0000000..a3d99e9
--- /dev/null
+++ b/test/disabled/koji/test-crypto-dh-odd-key.js
@@ -0,0 +1,31 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+
+var crypto = require('crypto');
+var odd = new Buffer(39);
+odd.fill('A');
+
+var c = crypto.createDiffieHellman(32);
+c.setPrivateKey(odd);
+c.generateKeys();
diff --git a/test/disabled/koji/test-crypto-stream.js b/test/disabled/koji/test-crypto-stream.js
new file mode 100644
index 0000000..402761e
--- /dev/null
+++ b/test/disabled/koji/test-crypto-stream.js
@@ -0,0 +1,76 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+var stream = require('stream');
+var util = require('util');
+
+try {
+ var crypto = require('crypto');
+} catch (e) {
+ console.log('Not compiled with OPENSSL support.');
+ process.exit();
+}
+
+// Small stream to buffer converter
+function Stream2buffer(callback) {
+ stream.Writable.call(this);
+
+ this._buffers = [];
+ this.once('finish', function () {
+ callback(null, Buffer.concat(this._buffers));
+ });
+}
+util.inherits(Stream2buffer, stream.Writable);
+
+Stream2buffer.prototype._write = function (data, encodeing, done) {
+ this._buffers.push(data);
+ return done(null);
+};
+
+// Create an md5 hash of "Hallo world"
+var hasher1 = crypto.createHash('md5');
+ hasher1.pipe(new Stream2buffer(common.mustCall(function end(err, hash) {
+ assert.equal(err, null);
+ assert.equal(hash.toString('hex'), '06460dadb35d3d503047ce750ceb2d07');
+ })));
+ hasher1.end('Hallo world');
+
+// Simpler check for unpipe, setEncoding, pause and resume
+crypto.createHash('md5').unpipe({});
+crypto.createHash('md5').setEncoding('utf8');
+crypto.createHash('md5').pause();
+crypto.createHash('md5').resume();
+
+// Decipher._flush() should emit an error event, not an exception.
+var key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex'),
+ badkey = new Buffer('12341234123412341234123412341234', 'hex'),
+ iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex'),
+ cipher = crypto.createCipheriv('aes-128-cbc', key, iv),
+ decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
+
+cipher.pipe(decipher)
+ .on('error', common.mustCall(function end(err) {
+ assert(/:00000000:/.test(err));
+ }));
+
+cipher.end('Papaya!'); // Should not cause an unhandled exception.
diff --git a/test/disabled/koji/test-debugger-client.js b/test/disabled/koji/test-debugger-client.js
new file mode 100644
index 0000000..6480e1c
--- /dev/null
+++ b/test/disabled/koji/test-debugger-client.js
@@ -0,0 +1,232 @@
+// 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.
+
+
+
+
+process.env.NODE_DEBUGGER_TIMEOUT = 2000;
+var common = require('../common');
+var assert = require('assert');
+var debug = require('_debugger');
+
+var debugPort = common.PORT + 1337;
+debug.port = debugPort;
+var spawn = require('child_process').spawn;
+
+setTimeout(function() {
+ if (nodeProcess) nodeProcess.kill('SIGTERM');
+ throw new Error('timeout');
+}, 10000).unref();
+
+
+var resCount = 0;
+var p = new debug.Protocol();
+p.onResponse = function(res) {
+ resCount++;
+};
+
+p.execute('Type: connect\r\n' +
+ 'V8-Version: 3.0.4.1\r\n' +
+ 'Protocol-Version: 1\r\n' +
+ 'Embedding-Host: node v0.3.3-pre\r\n' +
+ 'Content-Length: 0\r\n\r\n');
+assert.equal(1, resCount);
+
+// Make sure split messages go in.
+
+var parts = [];
+parts.push('Content-Length: 336\r\n');
+assert.equal(21, parts[0].length);
+parts.push('\r\n');
+assert.equal(2, parts[1].length);
+var bodyLength = 0;
+
+parts.push('{"seq":12,"type":"event","event":"break","body":' +
+ '{"invocationText":"#<a Server>');
+assert.equal(78, parts[2].length);
+bodyLength += parts[2].length;
+
+parts.push('.[anonymous](req=#<an IncomingMessage>, ' +
+ 'res=#<a ServerResponse>)","sourceLine"');
+assert.equal(78, parts[3].length);
+bodyLength += parts[3].length;
+
+parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;",' +
+ '"script":{"id":24,"name":"/home/ryan/projects/node/' +
+ 'benchmark/http_simple.js","lineOffset":0,"columnOffset":0,' +
+ '"lineCount":98}}}');
+assert.equal(180, parts[4].length);
+bodyLength += parts[4].length;
+
+assert.equal(336, bodyLength);
+
+for (var i = 0; i < parts.length; i++) {
+ p.execute(parts[i]);
+}
+assert.equal(2, resCount);
+
+
+// Make sure that if we get backed up, we still manage to get all the
+// messages
+var d = 'Content-Length: 466\r\n\r\n' +
+ '{"seq":10,"type":"event","event":"afterCompile","success":true,' +
+ '"body":{"script":{"handle":1,"type":"script","name":"dns.js",' +
+ '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,' +
+ '"sourceStart":"(function (module, exports, require) {' +
+ 'var dns = process.binding(\'cares\')' +
+ ';\\nvar ne","sourceLength":6137,"scriptType":2,"compilationType":0,' +
+ '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":' +
+ '[{"handle":0' +
+ ',"type":"context","text":"#<a ContextMirror>"}],"running":true}' +
+ 'Content-Length: 119\r\n\r\n' +
+ '{"seq":11,"type":"event","event":"scriptCollected","success":true,' +
+ '"body":{"script":{"id":26}},"refs":[],"running":true}';
+p.execute(d);
+assert.equal(4, resCount);
+
+var expectedConnections = 0;
+var tests = [];
+function addTest(cb) {
+ expectedConnections++;
+ tests.push(cb);
+}
+
+addTest(function(client, done) {
+ console.error('requesting version');
+ client.reqVersion(function(err, v) {
+ assert.ok(!err);
+ console.log('version: %s', v);
+ assert.equal(process.versions.v8, v);
+ done();
+ });
+});
+
+addTest(function(client, done) {
+ console.error('requesting scripts');
+ client.reqScripts(function(err) {
+ assert.ok(!err);
+ console.error('got %d scripts', Object.keys(client.scripts).length);
+
+ var foundMainScript = false;
+ for (var k in client.scripts) {
+ var script = client.scripts[k];
+ if (script && script.name === 'node.js') {
+ foundMainScript = true;
+ break;
+ }
+ }
+ assert.ok(foundMainScript);
+ done();
+ });
+});
+
+addTest(function(client, done) {
+ console.error('eval 2+2');
+ client.reqEval('2+2', function(err, res) {
+ console.error(res);
+ assert.ok(!err);
+ assert.equal('4', res.text);
+ assert.equal(4, res.value);
+ done();
+ });
+});
+
+
+var connectCount = 0;
+var script = 'setTimeout(function () { console.log("blah"); });' +
+ 'setInterval(function () {}, 1000000);';
+
+var nodeProcess;
+
+function doTest(cb, done) {
+ var args = ['--debug=' + debugPort, '-e', script];
+ nodeProcess = spawn(process.execPath, args);
+
+ nodeProcess.stdout.once('data', function(c) {
+ console.log('>>> new node process: %d', nodeProcess.pid);
+ var failed = true;
+ try {
+ process._debugProcess(nodeProcess.pid);
+ failed = false;
+ } finally {
+ // At least TRY not to leave zombie procs if this fails.
+ if (failed)
+ nodeProcess.kill('SIGTERM');
+ }
+ console.log('>>> starting debugger session');
+ });
+
+ var didTryConnect = false;
+ nodeProcess.stderr.setEncoding('utf8');
+ var b = '';
+ nodeProcess.stderr.on('data', function(data) {
+ console.error('got stderr data %j', data);
+ nodeProcess.stderr.resume();
+ b += data;
+ if (didTryConnect == false &&
+ b.match(/debugger listening on port/)) {
+ didTryConnect = true;
+
+ setTimeout(function() {
+ // Wait for some data before trying to connect
+ var c = new debug.Client();
+ console.error('>>> connecting...');
+ c.connect(debug.port);
+ c.on('break', function(brk) {
+ c.reqContinue(function() {});
+ });
+ c.on('ready', function() {
+ connectCount++;
+ console.log('ready!');
+ cb(c, function() {
+ c.end();
+ c.on('end', function() {
+ console.error(
+ '>>> killing node process %d\n\n',
+ nodeProcess.pid);
+ nodeProcess.kill();
+ done();
+ });
+ });
+ });
+ });
+ }
+ });
+}
+
+
+function run() {
+ var t = tests[0];
+ if (!t) return;
+
+ doTest(t, function() {
+ tests.shift();
+ run();
+ });
+}
+
+run();
+
+process.on('exit', function(code) {
+ if (!code)
+ assert.equal(expectedConnections, connectCount);
+});
+
diff --git a/test/disabled/koji/test-debugger-repl-utf8.js b/test/disabled/koji/test-debugger-repl-utf8.js
new file mode 100644
index 0000000..73314b8
--- /dev/null
+++ b/test/disabled/koji/test-debugger-repl-utf8.js
@@ -0,0 +1,27 @@
+// 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.
+
+var common = require('../common');
+var script = common.fixturesDir + '/breakpoints_utf8.js';
+process.env.NODE_DEBUGGER_TEST_SCRIPT = script;
+
+require('./test-debugger-repl.js');
+
diff --git a/test/disabled/koji/test-debugger-repl.js b/test/disabled/koji/test-debugger-repl.js
new file mode 100644
index 0000000..40639e0
--- /dev/null
+++ b/test/disabled/koji/test-debugger-repl.js
@@ -0,0 +1,77 @@
+// 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.
+
+var repl = require('./helper-debugger-repl.js');
+
+repl.startDebugger('breakpoints.js');
+
+var addTest = repl.addTest;
+
+// Next
+addTest('n', [
+ /break in .*:11/,
+ /9/, /10/, /11/, /12/, /13/
+]);
+
+// Watch
+addTest('watch("\'x\'")');
+
+// Continue
+addTest('c', [
+ /break in .*:5/,
+ /Watchers/,
+ /0:\s+'x' = "x"/,
+ /()/,
+ /3/, /4/, /5/, /6/, /7/
+]);
+
+// Show watchers
+addTest('watchers', [
+ /0:\s+'x' = "x"/
+]);
+
+// Unwatch
+addTest('unwatch("\'x\'")');
+
+// Step out
+addTest('o', [
+ /break in .*:12/,
+ /10/, /11/, /12/, /13/, /14/
+]);
+
+// Continue
+addTest('c', [
+ /break in .*:5/,
+ /3/, /4/, /5/, /6/, /7/
+]);
+
+// Set breakpoint by function name
+addTest('sb("setInterval()", "!(setInterval.flag++)")', [
+ /1/, /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/
+]);
+
+// Continue
+addTest('c', [
+ /break in node.js:\d+/,
+ /\d/, /\d/, /\d/, /\d/, /\d/
+]);
+
+addTest('quit', []);
diff --git a/test/disabled/koji/test-dgram-broadcast-multi-process.js b/test/disabled/koji/test-dgram-broadcast-multi-process.js
new file mode 100644
index 0000000..ad5b4eb
--- /dev/null
+++ b/test/disabled/koji/test-dgram-broadcast-multi-process.js
@@ -0,0 +1,240 @@
+// 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.
+
+var common = require('../common'),
+ assert = require('assert'),
+ dgram = require('dgram'),
+ util = require('util'),
+ networkInterfaces = require('os').networkInterfaces(),
+ Buffer = require('buffer').Buffer,
+ fork = require('child_process').fork,
+ LOCAL_BROADCAST_HOST = '255.255.255.255',
+ TIMEOUT = 5000,
+ messages = [
+ new Buffer('First message to send'),
+ new Buffer('Second message to send'),
+ new Buffer('Third message to send'),
+ new Buffer('Fourth message to send')
+ ];
+
+// take the first non-internal interface as the address for binding
+get_bindAddress: for (var name in networkInterfaces) {
+ var interfaces = networkInterfaces[name];
+ for(var i = 0; i < interfaces.length; i++) {
+ var localInterface = interfaces[i];
+ if (!localInterface.internal && localInterface.family === 'IPv4') {
+ var bindAddress = localInterface.address;
+ break get_bindAddress;
+ }
+ }
+}
+assert.ok(bindAddress);
+
+if (process.argv[2] !== 'child') {
+ var workers = {},
+ listeners = 3,
+ listening = 0,
+ dead = 0,
+ i = 0,
+ done = 0,
+ timer = null;
+
+ //exit the test if it doesn't succeed within TIMEOUT
+ timer = setTimeout(function() {
+ console.error('[PARENT] Responses were not received within %d ms.',
+ TIMEOUT);
+ console.error('[PARENT] Fail');
+
+ killChildren(workers);
+
+ process.exit(1);
+ }, TIMEOUT);
+
+ //launch child processes
+ for (var x = 0; x < listeners; x++) {
+ (function() {
+ var worker = fork(process.argv[1], ['child']);
+ workers[worker.pid] = worker;
+
+ worker.messagesReceived = [];
+
+ //handle the death of workers
+ worker.on('exit', function(code, signal) {
+ // don't consider this the true death if the worker
+ // has finished successfully
+ // or if the exit code is 0
+ if (worker.isDone || code == 0) {
+ return;
+ }
+
+ dead += 1;
+ console.error('[PARENT] Worker %d died. %d dead of %d',
+ worker.pid,
+ dead,
+ listeners);
+
+ if (dead === listeners) {
+ console.error('[PARENT] All workers have died.');
+ console.error('[PARENT] Fail');
+
+ killChildren(workers);
+
+ process.exit(1);
+ }
+ });
+
+ worker.on('message', function(msg) {
+ if (msg.listening) {
+ listening += 1;
+
+ if (listening === listeners) {
+ //all child process are listening, so start sending
+ sendSocket.sendNext();
+ }
+ }
+ else if (msg.message) {
+ worker.messagesReceived.push(msg.message);
+
+ if (worker.messagesReceived.length === messages.length) {
+ done += 1;
+ worker.isDone = true;
+ console.error('[PARENT] %d received %d messages total.',
+ worker.pid,
+ worker.messagesReceived.length);
+ }
+
+ if (done === listeners) {
+ console.error('[PARENT] All workers have received the ' +
+ 'required number of ' +
+ 'messages. Will now compare.');
+
+ Object.keys(workers).forEach(function(pid) {
+ var worker = workers[pid];
+
+ var count = 0;
+
+ worker.messagesReceived.forEach(function(buf) {
+ for (var i = 0; i < messages.length; ++i) {
+ if (buf.toString() === messages[i].toString()) {
+ count++;
+ break;
+ }
+ }
+ });
+
+ console.error('[PARENT] %d received %d matching messges.',
+ worker.pid,
+ count);
+
+ assert.equal(count, messages.length,
+ 'A worker received an invalid multicast message');
+ });
+
+ clearTimeout(timer);
+ console.error('[PARENT] Success');
+ killChildren(workers);
+ }
+ }
+ });
+ })(x);
+ }
+
+ var sendSocket = dgram.createSocket('udp4');
+
+ // bind the address explicitly for sending
+ // INADDR_BROADCAST to only one interface
+ sendSocket.bind(common.PORT, bindAddress);
+ sendSocket.on('listening', function () {
+ sendSocket.setBroadcast(true);
+ });
+
+ sendSocket.on('close', function() {
+ console.error('[PARENT] sendSocket closed');
+ });
+
+ sendSocket.sendNext = function() {
+ var buf = messages[i++];
+
+ if (!buf) {
+ try { sendSocket.close(); } catch (e) {}
+ return;
+ }
+
+ sendSocket.send(buf, 0, buf.length,
+ common.PORT, LOCAL_BROADCAST_HOST, function(err) {
+
+ if (err) throw err;
+
+ console.error('[PARENT] sent %s to %s:%s',
+ util.inspect(buf.toString()),
+ LOCAL_BROADCAST_HOST, common.PORT);
+
+ process.nextTick(sendSocket.sendNext);
+ });
+ };
+
+ function killChildren(children) {
+ Object.keys(children).forEach(function(key) {
+ var child = children[key];
+ child.kill();
+ });
+ }
+}
+
+if (process.argv[2] === 'child') {
+ var receivedMessages = [];
+ var listenSocket = dgram.createSocket('udp4');
+
+ listenSocket.on('message', function(buf, rinfo) {
+ // receive udp messages only sent from parent
+ if (rinfo.address !== bindAddress) return;
+
+ console.error('[CHILD] %s received %s from %j',
+ process.pid,
+ util.inspect(buf.toString()),
+ rinfo);
+
+ receivedMessages.push(buf);
+
+ process.send({ message: buf.toString() });
+
+ if (receivedMessages.length == messages.length) {
+ process.nextTick(function() {
+ listenSocket.close();
+ });
+ }
+ });
+
+ listenSocket.on('close', function() {
+ //HACK: Wait to exit the process to ensure that the parent
+ //process has had time to receive all messages via process.send()
+ //This may be indicitave of some other issue.
+ setTimeout(function() {
+ process.exit();
+ }, 1000);
+ });
+
+ listenSocket.on('listening', function() {
+ process.send({ listening: true });
+ });
+
+ listenSocket.bind(common.PORT);
+}
diff --git a/test/disabled/koji/test-fs-readfile-error.js b/test/disabled/koji/test-fs-readfile-error.js
new file mode 100644
index 0000000..97d2f06
--- /dev/null
+++ b/test/disabled/koji/test-fs-readfile-error.js
@@ -0,0 +1,64 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+var exec = require('child_process').exec;
+var path = require('path');
+
+var callbacks = 0;
+
+function test(env, cb) {
+ var filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
+ var execPath = process.execPath + ' --throw-deprecation ' + filename;
+ var options = { env: env || {} };
+ exec(execPath, options, function(err, stdout, stderr) {
+ assert(err);
+ assert.equal(stdout, '');
+ assert.notEqual(stderr, '');
+ cb('' + stderr);
+ });
+}
+
+test({ NODE_DEBUG: '' }, function(data) {
+ assert(/EISDIR/.test(data));
+ assert(!/test-fs-readfile-error/.test(data));
+ callbacks++;
+});
+
+test({ NODE_DEBUG: 'fs' }, function(data) {
+ assert(/EISDIR/.test(data));
+ assert(/test-fs-readfile-error/.test(data));
+ callbacks++;
+});
+
+process.on('exit', function() {
+ assert.equal(callbacks, 2);
+});
+
+(function() {
+ console.error('the warnings are normal here.');
+ // just make sure that this doesn't crash the process.
+ var fs = require('fs');
+ fs.readFile(__dirname);
+ fs.readdir(__filename);
+ fs.unlink('gee-i-sure-hope-this-file-isnt-important-or-existing');
+})();
diff --git a/test/disabled/koji/test-http-curl-chunk-problem.js b/test/disabled/koji/test-http-curl-chunk-problem.js
new file mode 100644
index 0000000..5b1cb0b
--- /dev/null
+++ b/test/disabled/koji/test-http-curl-chunk-problem.js
@@ -0,0 +1,85 @@
+// 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.
+
+if (!process.versions.openssl) {
+ console.error('Skipping because node compiled without OpenSSL.');
+ process.exit(0);
+}
+
+// http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919
+var common = require('../common');
+var assert = require('assert');
+var http = require('http');
+var cp = require('child_process');
+var fs = require('fs');
+
+var filename = require('path').join(common.tmpDir, 'big');
+
+var count = 0;
+function maybeMakeRequest() {
+ if (++count < 2) return;
+ console.log('making curl request');
+ var cmd = 'curl http://127.0.0.1:' + common.PORT + '/ | openssl sha1';
+ cp.exec(cmd, function(err, stdout, stderr) {
+ if (err) throw err;
+ var hex = stdout.match(/([A-Fa-f0-9]{40})/)[0];
+ assert.equal('8c206a1a87599f532ce68675536f0b1546900d7a', hex);
+ console.log('got the correct response');
+ fs.unlink(filename);
+ server.close();
+ });
+}
+
+
+var ddcmd = common.ddCommand(filename, 10240);
+console.log('dd command: ', ddcmd);
+
+cp.exec(ddcmd, function(err, stdout, stderr) {
+ if (err) throw err;
+ maybeMakeRequest();
+});
+
+
+var server = http.createServer(function(req, res) {
+ res.writeHead(200);
+
+ // Create the subprocess
+ var cat = cp.spawn('cat', [filename]);
+
+ // Stream the data through to the response as binary chunks
+ cat.stdout.on('data', function(data) {
+ res.write(data);
+ });
+
+ // End the response on exit (and log errors)
+ cat.on('exit', function(code) {
+ if (code !== 0) {
+ console.error('subprocess exited with code ' + code);
+ exit(1);
+ }
+ res.end();
+ });
+
+});
+
+server.listen(common.PORT, maybeMakeRequest);
+
+console.log('Server running at http://localhost:8080');
diff --git a/test/disabled/koji/test-http-many-keep-alive-connections.js b/test/disabled/koji/test-http-many-keep-alive-connections.js
new file mode 100644
index 0000000..adbebbd
--- /dev/null
+++ b/test/disabled/koji/test-http-many-keep-alive-connections.js
@@ -0,0 +1,69 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+var http = require('http');
+
+var expected = 10000;
+var responses = 0;
+var requests = 0;
+var connection;
+
+var server = http.Server(function(req, res) {
+ requests++;
+ assert.equal(req.connection, connection);
+ res.writeHead(200);
+ res.end('hello world\n');
+});
+
+server.once('connection', function(c) {
+ connection = c;
+});
+
+server.listen(common.PORT, function() {
+ var callee = arguments.callee;
+ var request = http.get({
+ port: common.PORT,
+ path: '/',
+ headers: {
+ 'Connection': 'Keep-alive'
+ }
+ }, function(res) {
+ res.on('end', function() {
+ if (++responses < expected) {
+ callee();
+ } else {
+ server.close();
+ }
+ });
+ res.resume();
+ }).on('error', function(e) {
+ console.log(e.message);
+ process.exit(1);
+ });
+ request.agent.maxSockets = 1;
+});
+
+process.on('exit', function() {
+ assert.equal(expected, responses);
+ assert.equal(expected, requests);
+});
diff --git a/test/disabled/koji/test-net-GH-5504.js b/test/disabled/koji/test-net-GH-5504.js
new file mode 100644
index 0000000..d5059f0
--- /dev/null
+++ b/test/disabled/koji/test-net-GH-5504.js
@@ -0,0 +1,123 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+
+// this test only fails with CentOS 6.3 using kernel version 2.6.32
+// On other linuxes and darwin, the `read` call gets an ECONNRESET in
+// that case. On sunos, the `write` call fails with EPIPE.
+//
+// However, old CentOS will occasionally send an EOF instead of a
+// ECONNRESET or EPIPE when the client has been destroyed abruptly.
+//
+// Make sure we don't keep trying to write or read more in that case.
+
+switch (process.argv[2]) {
+ case 'server': return server();
+ case 'client': return client();
+ case undefined: return parent();
+ default: throw new Error('wtf');
+}
+
+function server() {
+ var net = require('net');
+ var content = new Buffer(64 * 1024 * 1024);
+ content.fill('#');
+ net.createServer(function(socket) {
+ this.close();
+ socket.on('end', function() {
+ console.error('end');
+ });
+ socket.on('_socketEnd', function() {
+ console.error('_socketEnd');
+ });
+ socket.write(content);
+ }).listen(3000, function() {
+ console.log('listening');
+ });
+}
+
+function client() {
+ var net = require('net');
+ var client = net.connect({
+ host: 'localhost',
+ port: 3000
+ }, function() {
+ client.destroy();
+ });
+}
+
+function parent() {
+ var spawn = require('child_process').spawn;
+ var node = process.execPath;
+ var assert = require('assert');
+ var serverExited = false;
+ var clientExited = false;
+ var serverListened = false;
+ var opt = { env: { NODE_DEBUG: 'net' } };
+
+ process.on('exit', function() {
+ assert(serverExited);
+ assert(clientExited);
+ assert(serverListened);
+ console.log('ok');
+ });
+
+ setTimeout(function() {
+ if (s) s.kill();
+ if (c) c.kill();
+ setTimeout(function() {
+ throw new Error('hang');
+ });
+ }, 1000).unref();
+
+ var s = spawn(node, [__filename, 'server'], opt);
+ var c;
+
+ wrap(s.stderr, process.stderr, 'SERVER 2>');
+ wrap(s.stdout, process.stdout, 'SERVER 1>');
+ s.on('exit', function(c) {
+ console.error('server exited', c);
+ serverExited = true;
+ });
+
+ s.stdout.once('data', function() {
+ serverListened = true;
+ c = spawn(node, [__filename, 'client']);
+ wrap(c.stderr, process.stderr, 'CLIENT 2>');
+ wrap(c.stdout, process.stdout, 'CLIENT 1>');
+ c.on('exit', function(c) {
+ console.error('client exited', c);
+ clientExited = true;
+ });
+ });
+
+ function wrap(inp, out, w) {
+ inp.setEncoding('utf8');
+ inp.on('data', function(c) {
+ c = c.trim();
+ if (!c) return;
+ out.write(w + c.split('\n').join('\n' + w) + '\n');
+ });
+ }
+}
+
diff --git a/test/disabled/koji/test-setproctitle.js b/test/disabled/koji/test-setproctitle.js
new file mode 100644
index 0000000..6373af4
--- /dev/null
+++ b/test/disabled/koji/test-setproctitle.js
@@ -0,0 +1,52 @@
+// 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.
+
+// Original test written by Jakub Lekstan <kuebzky@gmail.com>
+
+// FIXME add sunos support
+if ('linux freebsd darwin'.indexOf(process.platform) === -1) {
+ console.error('Skipping test, platform not supported.');
+ process.exit();
+}
+
+var common = require('../common');
+var assert = require('assert');
+var exec = require('child_process').exec;
+
+// The title shouldn't be too long; libuv's uv_set_process_title() out of
+// security considerations no longer overwrites envp, only argv, so the
+// maximum title length is possibly quite short.
+var title = 'testme';
+
+assert.notEqual(process.title, title);
+process.title = title;
+assert.equal(process.title, title);
+
+exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
+ assert.equal(error, null);
+ assert.equal(stderr, '');
+
+ // freebsd always add ' (procname)' to the process title
+ if (process.platform === 'freebsd') title += ' (node)';
+
+ // omitting trailing whitespace and \n
+ assert.equal(stdout.replace(/\s+$/, ''), title);
+});
diff --git a/test/disabled/koji/test-stdout-close-unref.js b/test/disabled/koji/test-stdout-close-unref.js
new file mode 100644
index 0000000..42f3997
--- /dev/null
+++ b/test/disabled/koji/test-stdout-close-unref.js
@@ -0,0 +1,24 @@
+// 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.
+
+process.stdin.resume();
+process.stdin._handle.close();
+process.stdin._handle.unref(); // Should not segfault.
diff --git a/test/disabled/koji/test-timers-ordering.js b/test/disabled/koji/test-timers-ordering.js
new file mode 100644
index 0000000..0a32d48
--- /dev/null
+++ b/test/disabled/koji/test-timers-ordering.js
@@ -0,0 +1,48 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+var i;
+
+var N = 30;
+
+var last_i = 0;
+var last_ts = 0;
+var start = Date.now();
+
+var f = function(i) {
+ if (i <= N) {
+ // check order
+ assert.equal(i, last_i + 1, 'order is broken: ' + i + ' != ' + last_i + ' + 1');
+ last_i = i;
+
+ // check that this iteration is fired at least 1ms later than the previous
+ var now = Date.now();
+ console.log(i, now);
+ assert(now >= last_ts + 1, 'current ts ' + now + ' < prev ts ' + last_ts + ' + 1');
+ last_ts = now;
+
+ // schedule next iteration
+ setTimeout(f, 1, i + 1);
+ }
+};
+f(1);
diff --git a/test/disabled/koji/test-tls-securepair-client.js b/test/disabled/koji/test-tls-securepair-client.js
new file mode 100644
index 0000000..e361a14
--- /dev/null
+++ b/test/disabled/koji/test-tls-securepair-client.js
@@ -0,0 +1,201 @@
+// 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.
+
+if (!process.versions.openssl) {
+ console.error('Skipping because node compiled without OpenSSL.');
+ process.exit(0);
+}
+
+var common = require('../common');
+var join = require('path').join;
+var net = require('net');
+var assert = require('assert');
+var fs = require('fs');
+var crypto = require('crypto');
+var tls = require('tls');
+var exec = require('child_process').exec;
+var spawn = require('child_process').spawn;
+
+maybe(test1);
+
+// There is a bug with 'openssl s_server' which makes it not flush certain
+// important events to stdout when done over a pipe. Therefore we skip this
+// test for all openssl versions less than 1.0.0.
+function maybe(cb) {
+ exec('openssl version', function(err, data) {
+ if (err) throw err;
+ if (/OpenSSL 0\./.test(data)) {
+ console.error('Skipping due to old OpenSSL version.');
+ return;
+ }
+ cb();
+ });
+}
+
+// simple/test-tls-securepair-client
+function test1() {
+ test('agent.key', 'agent.crt', null, test2);
+}
+
+// simple/test-tls-ext-key-usage
+function test2() {
+ function check(pair) {
+ // "TLS Web Client Authentication"
+ assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage.length, 1);
+ assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0],
+ '1.3.6.1.5.5.7.3.2');
+ }
+ test('keys/agent4-key.pem', 'keys/agent4-cert.pem', check);
+}
+
+function test(keyfn, certfn, check, next) {
+ // FIXME: Avoid the common PORT as this test currently hits a C-level
+ // assertion error with node_g. The program aborts without HUPing
+ // the openssl s_server thus causing many tests to fail with
+ // EADDRINUSE.
+ var PORT = common.PORT + 5;
+
+ var connections = 0;
+
+ keyfn = join(common.fixturesDir, keyfn);
+ var key = fs.readFileSync(keyfn).toString();
+
+ certfn = join(common.fixturesDir, certfn);
+ var cert = fs.readFileSync(certfn).toString();
+
+ var server = spawn('openssl', ['s_server',
+ '-accept', PORT,
+ '-cert', certfn,
+ '-key', keyfn]);
+ server.stdout.pipe(process.stdout);
+ server.stderr.pipe(process.stdout);
+
+
+ var state = 'WAIT-ACCEPT';
+
+ var serverStdoutBuffer = '';
+ server.stdout.setEncoding('utf8');
+ server.stdout.on('data', function(s) {
+ serverStdoutBuffer += s;
+ console.error(state);
+ switch (state) {
+ case 'WAIT-ACCEPT':
+ if (/ACCEPT/g.test(serverStdoutBuffer)) {
+ // Give s_server half a second to start up.
+ setTimeout(startClient, 500);
+ state = 'WAIT-HELLO';
+ }
+ break;
+
+ case 'WAIT-HELLO':
+ if (/hello/g.test(serverStdoutBuffer)) {
+
+ // End the current SSL connection and exit.
+ // See s_server(1ssl).
+ server.stdin.write('Q');
+
+ state = 'WAIT-SERVER-CLOSE';
+ }
+ break;
+
+ default:
+ break;
+ }
+ });
+
+
+ var timeout = setTimeout(function() {
+ server.kill();
+ process.exit(1);
+ }, 5000);
+
+ var gotWriteCallback = false;
+ var serverExitCode = -1;
+
+ server.on('exit', function(code) {
+ serverExitCode = code;
+ clearTimeout(timeout);
+ if (next) next();
+ });
+
+
+ function startClient() {
+ var s = new net.Stream();
+
+ var sslcontext = crypto.createCredentials({key: key, cert: cert});
+ sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
+
+ var pair = tls.createSecurePair(sslcontext, false);
+
+ assert.ok(pair.encrypted.writable);
+ assert.ok(pair.cleartext.writable);
+
+ pair.encrypted.pipe(s);
+ s.pipe(pair.encrypted);
+
+ s.connect(PORT);
+
+ s.on('connect', function() {
+ console.log('client connected');
+ });
+
+ pair.on('secure', function() {
+ console.log('client: connected+secure!');
+ console.log('client pair.cleartext.getPeerCertificate(): %j',
+ pair.cleartext.getPeerCertificate());
+ console.log('client pair.cleartext.getCipher(): %j',
+ pair.cleartext.getCipher());
+ if (check) check(pair);
+ setTimeout(function() {
+ pair.cleartext.write('hello\r\n', function() {
+ gotWriteCallback = true;
+ });
+ }, 500);
+ });
+
+ pair.cleartext.on('data', function(d) {
+ console.log('cleartext: %s', d.toString());
+ });
+
+ s.on('close', function() {
+ console.log('client close');
+ });
+
+ pair.encrypted.on('error', function(err) {
+ console.log('encrypted error: ' + err);
+ });
+
+ s.on('error', function(err) {
+ console.log('socket error: ' + err);
+ });
+
+ pair.on('error', function(err) {
+ console.log('secure error: ' + err);
+ });
+ }
+
+
+ process.on('exit', function() {
+ assert.equal(0, serverExitCode);
+ assert.equal('WAIT-SERVER-CLOSE', state);
+ assert.ok(gotWriteCallback);
+ });
+}
diff --git a/test/disabled/koji/test-tls-securepair-server.js b/test/disabled/koji/test-tls-securepair-server.js
new file mode 100644
index 0000000..3b4eec1
--- /dev/null
+++ b/test/disabled/koji/test-tls-securepair-server.js
@@ -0,0 +1,154 @@
+// 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.
+
+if (!process.versions.openssl) {
+ console.error('Skipping because node compiled without OpenSSL.');
+ process.exit(0);
+}
+
+
+var common = require('../common');
+var assert = require('assert');
+
+var join = require('path').join;
+var net = require('net');
+var fs = require('fs');
+var crypto = require('crypto');
+var tls = require('tls');
+var spawn = require('child_process').spawn;
+
+var connections = 0;
+var key = fs.readFileSync(join(common.fixturesDir, 'agent.key')).toString();
+var cert = fs.readFileSync(join(common.fixturesDir, 'agent.crt')).toString();
+
+function log(a) {
+ console.error('***server*** ' + a);
+}
+
+var server = net.createServer(function(socket) {
+ connections++;
+ log('connection fd=' + socket.fd);
+ var sslcontext = crypto.createCredentials({key: key, cert: cert});
+ sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
+
+ var pair = tls.createSecurePair(sslcontext, true);
+
+ assert.ok(pair.encrypted.writable);
+ assert.ok(pair.cleartext.writable);
+
+ pair.encrypted.pipe(socket);
+ socket.pipe(pair.encrypted);
+
+ log('i set it secure');
+
+ pair.on('secure', function() {
+ log('connected+secure!');
+ pair.cleartext.write('hello\r\n');
+ log(pair.cleartext.getPeerCertificate());
+ log(pair.cleartext.getCipher());
+ });
+
+ pair.cleartext.on('data', function(data) {
+ log('read bytes ' + data.length);
+ pair.cleartext.write(data);
+ });
+
+ socket.on('end', function() {
+ log('socket end');
+ });
+
+ pair.cleartext.on('error', function(err) {
+ log('got error: ');
+ log(err);
+ log(err.stack);
+ socket.destroy();
+ });
+
+ pair.encrypted.on('error', function(err) {
+ log('encrypted error: ');
+ log(err);
+ log(err.stack);
+ socket.destroy();
+ });
+
+ socket.on('error', function(err) {
+ log('socket error: ');
+ log(err);
+ log(err.stack);
+ socket.destroy();
+ });
+
+ socket.on('close', function(err) {
+ log('socket closed');
+ });
+
+ pair.on('error', function(err) {
+ log('secure error: ');
+ log(err);
+ log(err.stack);
+ socket.destroy();
+ });
+});
+
+var gotHello = false;
+var sentWorld = false;
+var gotWorld = false;
+var opensslExitCode = -1;
+
+server.listen(common.PORT, function() {
+ // To test use: openssl s_client -connect localhost:8000
+ var client = spawn('openssl', ['s_client', '-connect', '127.0.0.1:' +
+ common.PORT]);
+
+
+ var out = '';
+
+ client.stdout.setEncoding('utf8');
+ client.stdout.on('data', function(d) {
+ out += d;
+
+ if (!gotHello && /hello/.test(out)) {
+ gotHello = true;
+ client.stdin.write('world\r\n');
+ sentWorld = true;
+ }
+
+ if (!gotWorld && /world/.test(out)) {
+ gotWorld = true;
+ client.stdin.end();
+ }
+ });
+
+ client.stdout.pipe(process.stdout, { end: false });
+
+ client.on('exit', function(code) {
+ opensslExitCode = code;
+ server.close();
+ });
+});
+
+process.on('exit', function() {
+ assert.equal(1, connections);
+ assert.ok(gotHello);
+ assert.ok(sentWorld);
+ assert.ok(gotWorld);
+ assert.equal(0, opensslExitCode);
+});
diff --git a/test/disabled/koji/test-tls-set-ciphers.js b/test/disabled/koji/test-tls-set-ciphers.js
new file mode 100644
index 0000000..a473a1d
--- /dev/null
+++ b/test/disabled/koji/test-tls-set-ciphers.js
@@ -0,0 +1,62 @@
+// 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.
+
+var common = require('../common');
+var assert = require('assert');
+var exec = require('child_process').exec;
+var tls = require('tls');
+var fs = require('fs');
+
+if (process.platform === 'win32') {
+ console.log("Skipping test, you probably don't have openssl installed.");
+ process.exit();
+}
+
+var options = {
+ key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
+ cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
+ ciphers: 'RC4-MD5'
+};
+
+var reply = 'I AM THE WALRUS'; // something recognizable
+var nconns = 0;
+var response = '';
+
+process.on('exit', function() {
+ assert.equal(nconns, 1);
+ assert.notEqual(response.indexOf(reply), -1);
+});
+
+var server = tls.createServer(options, function(conn) {
+ conn.end(reply);
+ nconns++;
+});
+
+server.listen(common.PORT, '127.0.0.1', function() {
+ var cmd = 'openssl s_client -cipher ' + options.ciphers +
+ ' -connect 127.0.0.1:' + common.PORT;
+
+ exec(cmd, function(err, stdout, stderr) {
+ if (err) throw err;
+ response = stdout;
+ server.close();
+ });
+});
diff --git a/test/simple/test-child-process-fork-dgram.js b/test/simple/test-child-process-fork-dgram.js
deleted file mode 100644
index 1c4e9ac..0000000
--- a/test/simple/test-child-process-fork-dgram.js
+++ /dev/null
@@ -1,122 +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.
-
-/*
- * The purpose of this test is to make sure that when forking a process,
- * sending a fd representing a UDP socket to the child and sending messages
- * to this endpoint, these messages are distributed to the parent and the
- * child process.
- *
- * Because it's not really possible to predict how the messages will be
- * distributed among the parent and the child processes, we keep sending
- * messages until both the parent and the child received at least one
- * message. The worst case scenario is when either one never receives
- * a message. In this case the test runner will timeout after 60 secs
- * and the test will fail.
- */
-
-var dgram = require('dgram');
-var fork = require('child_process').fork;
-var assert = require('assert');
-var common = require('../common');
-
-if (process.platform === 'win32') {
- console.error('Sending dgram sockets to child processes not supported');
- process.exit(0);
-}
-
-if (process.argv[2] === 'child') {
- var childCollected = 0;
- var server;
-
- process.on('message', function removeMe(msg, clusterServer) {
- if (msg === 'server') {
- server = clusterServer;
-
- server.on('message', function () {
- process.send('gotMessage');
- });
-
- } else if (msg === 'stop') {
- server.close();
- process.removeListener('message', removeMe);
- }
- });
-
-} else {
- var server = dgram.createSocket('udp4');
- var client = dgram.createSocket('udp4');
- var child = fork(__filename, ['child']);
-
- var msg = new Buffer('Some bytes');
-
- var childGotMessage = false;
- var parentGotMessage = false;
-
- server.on('message', function (msg, rinfo) {
- parentGotMessage = true;
- });
-
- server.on('listening', function () {
- child.send('server', server);
-
- child.once('message', function (msg) {
- if (msg === 'gotMessage') {
- childGotMessage = true;
- }
- });
-
- sendMessages();
- });
-
- var sendMessages = function () {
- var timer = setInterval(function () {
- client.send(msg, 0, msg.length, common.PORT, '127.0.0.1', function(err) {
- if (err) throw err;
- }
- );
-
- /*
- * Both the parent and the child got at least one message,
- * test passed, clean up everyting.
- */
- if (parentGotMessage && childGotMessage) {
- clearInterval(timer);
- shutdown();
- }
-
- }, 1);
- };
-
- var shutdown = function () {
- child.send('stop');
-
- server.close();
- client.close();
- };
-
- server.bind(common.PORT, '127.0.0.1');
-
- process.once('exit', function () {
- assert(parentGotMessage);
- assert(childGotMessage);
- });
-}
diff --git a/test/simple/test-crypto-dh-odd-key.js b/test/simple/test-crypto-dh-odd-key.js
deleted file mode 100644
index a3d99e9..0000000
--- a/test/simple/test-crypto-dh-odd-key.js
+++ /dev/null
@@ -1,31 +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.
-
-var common = require('../common');
-var assert = require('assert');
-
-var crypto = require('crypto');
-var odd = new Buffer(39);
-odd.fill('A');
-
-var c = crypto.createDiffieHellman(32);
-c.setPrivateKey(odd);
-c.generateKeys();
diff --git a/test/simple/test-crypto-stream.js b/test/simple/test-crypto-stream.js
deleted file mode 100644
index 402761e..0000000
--- a/test/simple/test-crypto-stream.js
+++ /dev/null
@@ -1,76 +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.
-
-var common = require('../common');
-var assert = require('assert');
-var stream = require('stream');
-var util = require('util');
-
-try {
- var crypto = require('crypto');
-} catch (e) {
- console.log('Not compiled with OPENSSL support.');
- process.exit();
-}
-
-// Small stream to buffer converter
-function Stream2buffer(callback) {
- stream.Writable.call(this);
-
- this._buffers = [];
- this.once('finish', function () {
- callback(null, Buffer.concat(this._buffers));
- });
-}
-util.inherits(Stream2buffer, stream.Writable);
-
-Stream2buffer.prototype._write = function (data, encodeing, done) {
- this._buffers.push(data);
- return done(null);
-};
-
-// Create an md5 hash of "Hallo world"
-var hasher1 = crypto.createHash('md5');
- hasher1.pipe(new Stream2buffer(common.mustCall(function end(err, hash) {
- assert.equal(err, null);
- assert.equal(hash.toString('hex'), '06460dadb35d3d503047ce750ceb2d07');
- })));
- hasher1.end('Hallo world');
-
-// Simpler check for unpipe, setEncoding, pause and resume
-crypto.createHash('md5').unpipe({});
-crypto.createHash('md5').setEncoding('utf8');
-crypto.createHash('md5').pause();
-crypto.createHash('md5').resume();
-
-// Decipher._flush() should emit an error event, not an exception.
-var key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex'),
- badkey = new Buffer('12341234123412341234123412341234', 'hex'),
- iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex'),
- cipher = crypto.createCipheriv('aes-128-cbc', key, iv),
- decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
-
-cipher.pipe(decipher)
- .on('error', common.mustCall(function end(err) {
- assert(/:00000000:/.test(err));
- }));
-
-cipher.end('Papaya!'); // Should not cause an unhandled exception.
diff --git a/test/simple/test-debugger-client.js b/test/simple/test-debugger-client.js
deleted file mode 100644
index 6480e1c..0000000
--- a/test/simple/test-debugger-client.js
+++ /dev/null
@@ -1,232 +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.
-
-
-
-
-process.env.NODE_DEBUGGER_TIMEOUT = 2000;
-var common = require('../common');
-var assert = require('assert');
-var debug = require('_debugger');
-
-var debugPort = common.PORT + 1337;
-debug.port = debugPort;
-var spawn = require('child_process').spawn;
-
-setTimeout(function() {
- if (nodeProcess) nodeProcess.kill('SIGTERM');
- throw new Error('timeout');
-}, 10000).unref();
-
-
-var resCount = 0;
-var p = new debug.Protocol();
-p.onResponse = function(res) {
- resCount++;
-};
-
-p.execute('Type: connect\r\n' +
- 'V8-Version: 3.0.4.1\r\n' +
- 'Protocol-Version: 1\r\n' +
- 'Embedding-Host: node v0.3.3-pre\r\n' +
- 'Content-Length: 0\r\n\r\n');
-assert.equal(1, resCount);
-
-// Make sure split messages go in.
-
-var parts = [];
-parts.push('Content-Length: 336\r\n');
-assert.equal(21, parts[0].length);
-parts.push('\r\n');
-assert.equal(2, parts[1].length);
-var bodyLength = 0;
-
-parts.push('{"seq":12,"type":"event","event":"break","body":' +
- '{"invocationText":"#<a Server>');
-assert.equal(78, parts[2].length);
-bodyLength += parts[2].length;
-
-parts.push('.[anonymous](req=#<an IncomingMessage>, ' +
- 'res=#<a ServerResponse>)","sourceLine"');
-assert.equal(78, parts[3].length);
-bodyLength += parts[3].length;
-
-parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;",' +
- '"script":{"id":24,"name":"/home/ryan/projects/node/' +
- 'benchmark/http_simple.js","lineOffset":0,"columnOffset":0,' +
- '"lineCount":98}}}');
-assert.equal(180, parts[4].length);
-bodyLength += parts[4].length;
-
-assert.equal(336, bodyLength);
-
-for (var i = 0; i < parts.length; i++) {
- p.execute(parts[i]);
-}
-assert.equal(2, resCount);
-
-
-// Make sure that if we get backed up, we still manage to get all the
-// messages
-var d = 'Content-Length: 466\r\n\r\n' +
- '{"seq":10,"type":"event","event":"afterCompile","success":true,' +
- '"body":{"script":{"handle":1,"type":"script","name":"dns.js",' +
- '"id":34,"lineOffset":0,"columnOffset":0,"lineCount":241,' +
- '"sourceStart":"(function (module, exports, require) {' +
- 'var dns = process.binding(\'cares\')' +
- ';\\nvar ne","sourceLength":6137,"scriptType":2,"compilationType":0,' +
- '"context":{"ref":0},"text":"dns.js (lines: 241)"}},"refs":' +
- '[{"handle":0' +
- ',"type":"context","text":"#<a ContextMirror>"}],"running":true}' +
- 'Content-Length: 119\r\n\r\n' +
- '{"seq":11,"type":"event","event":"scriptCollected","success":true,' +
- '"body":{"script":{"id":26}},"refs":[],"running":true}';
-p.execute(d);
-assert.equal(4, resCount);
-
-var expectedConnections = 0;
-var tests = [];
-function addTest(cb) {
- expectedConnections++;
- tests.push(cb);
-}
-
-addTest(function(client, done) {
- console.error('requesting version');
- client.reqVersion(function(err, v) {
- assert.ok(!err);
- console.log('version: %s', v);
- assert.equal(process.versions.v8, v);
- done();
- });
-});
-
-addTest(function(client, done) {
- console.error('requesting scripts');
- client.reqScripts(function(err) {
- assert.ok(!err);
- console.error('got %d scripts', Object.keys(client.scripts).length);
-
- var foundMainScript = false;
- for (var k in client.scripts) {
- var script = client.scripts[k];
- if (script && script.name === 'node.js') {
- foundMainScript = true;
- break;
- }
- }
- assert.ok(foundMainScript);
- done();
- });
-});
-
-addTest(function(client, done) {
- console.error('eval 2+2');
- client.reqEval('2+2', function(err, res) {
- console.error(res);
- assert.ok(!err);
- assert.equal('4', res.text);
- assert.equal(4, res.value);
- done();
- });
-});
-
-
-var connectCount = 0;
-var script = 'setTimeout(function () { console.log("blah"); });' +
- 'setInterval(function () {}, 1000000);';
-
-var nodeProcess;
-
-function doTest(cb, done) {
- var args = ['--debug=' + debugPort, '-e', script];
- nodeProcess = spawn(process.execPath, args);
-
- nodeProcess.stdout.once('data', function(c) {
- console.log('>>> new node process: %d', nodeProcess.pid);
- var failed = true;
- try {
- process._debugProcess(nodeProcess.pid);
- failed = false;
- } finally {
- // At least TRY not to leave zombie procs if this fails.
- if (failed)
- nodeProcess.kill('SIGTERM');
- }
- console.log('>>> starting debugger session');
- });
-
- var didTryConnect = false;
- nodeProcess.stderr.setEncoding('utf8');
- var b = '';
- nodeProcess.stderr.on('data', function(data) {
- console.error('got stderr data %j', data);
- nodeProcess.stderr.resume();
- b += data;
- if (didTryConnect == false &&
- b.match(/debugger listening on port/)) {
- didTryConnect = true;
-
- setTimeout(function() {
- // Wait for some data before trying to connect
- var c = new debug.Client();
- console.error('>>> connecting...');
- c.connect(debug.port);
- c.on('break', function(brk) {
- c.reqContinue(function() {});
- });
- c.on('ready', function() {
- connectCount++;
- console.log('ready!');
- cb(c, function() {
- c.end();
- c.on('end', function() {
- console.error(
- '>>> killing node process %d\n\n',
- nodeProcess.pid);
- nodeProcess.kill();
- done();
- });
- });
- });
- });
- }
- });
-}
-
-
-function run() {
- var t = tests[0];
- if (!t) return;
-
- doTest(t, function() {
- tests.shift();
- run();
- });
-}
-
-run();
-
-process.on('exit', function(code) {
- if (!code)
- assert.equal(expectedConnections, connectCount);
-});
-
diff --git a/test/simple/test-debugger-repl-utf8.js b/test/simple/test-debugger-repl-utf8.js
deleted file mode 100644
index 73314b8..0000000
--- a/test/simple/test-debugger-repl-utf8.js
+++ /dev/null
@@ -1,27 +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.
-
-var common = require('../common');
-var script = common.fixturesDir + '/breakpoints_utf8.js';
-process.env.NODE_DEBUGGER_TEST_SCRIPT = script;
-
-require('./test-debugger-repl.js');
-
diff --git a/test/simple/test-debugger-repl.js b/test/simple/test-debugger-repl.js
deleted file mode 100644
index 40639e0..0000000
--- a/test/simple/test-debugger-repl.js
+++ /dev/null
@@ -1,77 +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.
-
-var repl = require('./helper-debugger-repl.js');
-
-repl.startDebugger('breakpoints.js');
-
-var addTest = repl.addTest;
-
-// Next
-addTest('n', [
- /break in .*:11/,
- /9/, /10/, /11/, /12/, /13/
-]);
-
-// Watch
-addTest('watch("\'x\'")');
-
-// Continue
-addTest('c', [
- /break in .*:5/,
- /Watchers/,
- /0:\s+'x' = "x"/,
- /()/,
- /3/, /4/, /5/, /6/, /7/
-]);
-
-// Show watchers
-addTest('watchers', [
- /0:\s+'x' = "x"/
-]);
-
-// Unwatch
-addTest('unwatch("\'x\'")');
-
-// Step out
-addTest('o', [
- /break in .*:12/,
- /10/, /11/, /12/, /13/, /14/
-]);
-
-// Continue
-addTest('c', [
- /break in .*:5/,
- /3/, /4/, /5/, /6/, /7/
-]);
-
-// Set breakpoint by function name
-addTest('sb("setInterval()", "!(setInterval.flag++)")', [
- /1/, /2/, /3/, /4/, /5/, /6/, /7/, /8/, /9/, /10/
-]);
-
-// Continue
-addTest('c', [
- /break in node.js:\d+/,
- /\d/, /\d/, /\d/, /\d/, /\d/
-]);
-
-addTest('quit', []);
diff --git a/test/simple/test-dgram-broadcast-multi-process.js b/test/simple/test-dgram-broadcast-multi-process.js
deleted file mode 100644
index ad5b4eb..0000000
--- a/test/simple/test-dgram-broadcast-multi-process.js
+++ /dev/null
@@ -1,240 +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.
-
-var common = require('../common'),
- assert = require('assert'),
- dgram = require('dgram'),
- util = require('util'),
- networkInterfaces = require('os').networkInterfaces(),
- Buffer = require('buffer').Buffer,
- fork = require('child_process').fork,
- LOCAL_BROADCAST_HOST = '255.255.255.255',
- TIMEOUT = 5000,
- messages = [
- new Buffer('First message to send'),
- new Buffer('Second message to send'),
- new Buffer('Third message to send'),
- new Buffer('Fourth message to send')
- ];
-
-// take the first non-internal interface as the address for binding
-get_bindAddress: for (var name in networkInterfaces) {
- var interfaces = networkInterfaces[name];
- for(var i = 0; i < interfaces.length; i++) {
- var localInterface = interfaces[i];
- if (!localInterface.internal && localInterface.family === 'IPv4') {
- var bindAddress = localInterface.address;
- break get_bindAddress;
- }
- }
-}
-assert.ok(bindAddress);
-
-if (process.argv[2] !== 'child') {
- var workers = {},
- listeners = 3,
- listening = 0,
- dead = 0,
- i = 0,
- done = 0,
- timer = null;
-
- //exit the test if it doesn't succeed within TIMEOUT
- timer = setTimeout(function() {
- console.error('[PARENT] Responses were not received within %d ms.',
- TIMEOUT);
- console.error('[PARENT] Fail');
-
- killChildren(workers);
-
- process.exit(1);
- }, TIMEOUT);
-
- //launch child processes
- for (var x = 0; x < listeners; x++) {
- (function() {
- var worker = fork(process.argv[1], ['child']);
- workers[worker.pid] = worker;
-
- worker.messagesReceived = [];
-
- //handle the death of workers
- worker.on('exit', function(code, signal) {
- // don't consider this the true death if the worker
- // has finished successfully
- // or if the exit code is 0
- if (worker.isDone || code == 0) {
- return;
- }
-
- dead += 1;
- console.error('[PARENT] Worker %d died. %d dead of %d',
- worker.pid,
- dead,
- listeners);
-
- if (dead === listeners) {
- console.error('[PARENT] All workers have died.');
- console.error('[PARENT] Fail');
-
- killChildren(workers);
-
- process.exit(1);
- }
- });
-
- worker.on('message', function(msg) {
- if (msg.listening) {
- listening += 1;
-
- if (listening === listeners) {
- //all child process are listening, so start sending
- sendSocket.sendNext();
- }
- }
- else if (msg.message) {
- worker.messagesReceived.push(msg.message);
-
- if (worker.messagesReceived.length === messages.length) {
- done += 1;
- worker.isDone = true;
- console.error('[PARENT] %d received %d messages total.',
- worker.pid,
- worker.messagesReceived.length);
- }
-
- if (done === listeners) {
- console.error('[PARENT] All workers have received the ' +
- 'required number of ' +
- 'messages. Will now compare.');
-
- Object.keys(workers).forEach(function(pid) {
- var worker = workers[pid];
-
- var count = 0;
-
- worker.messagesReceived.forEach(function(buf) {
- for (var i = 0; i < messages.length; ++i) {
- if (buf.toString() === messages[i].toString()) {
- count++;
- break;
- }
- }
- });
-
- console.error('[PARENT] %d received %d matching messges.',
- worker.pid,
- count);
-
- assert.equal(count, messages.length,
- 'A worker received an invalid multicast message');
- });
-
- clearTimeout(timer);
- console.error('[PARENT] Success');
- killChildren(workers);
- }
- }
- });
- })(x);
- }
-
- var sendSocket = dgram.createSocket('udp4');
-
- // bind the address explicitly for sending
- // INADDR_BROADCAST to only one interface
- sendSocket.bind(common.PORT, bindAddress);
- sendSocket.on('listening', function () {
- sendSocket.setBroadcast(true);
- });
-
- sendSocket.on('close', function() {
- console.error('[PARENT] sendSocket closed');
- });
-
- sendSocket.sendNext = function() {
- var buf = messages[i++];
-
- if (!buf) {
- try { sendSocket.close(); } catch (e) {}
- return;
- }
-
- sendSocket.send(buf, 0, buf.length,
- common.PORT, LOCAL_BROADCAST_HOST, function(err) {
-
- if (err) throw err;
-
- console.error('[PARENT] sent %s to %s:%s',
- util.inspect(buf.toString()),
- LOCAL_BROADCAST_HOST, common.PORT);
-
- process.nextTick(sendSocket.sendNext);
- });
- };
-
- function killChildren(children) {
- Object.keys(children).forEach(function(key) {
- var child = children[key];
- child.kill();
- });
- }
-}
-
-if (process.argv[2] === 'child') {
- var receivedMessages = [];
- var listenSocket = dgram.createSocket('udp4');
-
- listenSocket.on('message', function(buf, rinfo) {
- // receive udp messages only sent from parent
- if (rinfo.address !== bindAddress) return;
-
- console.error('[CHILD] %s received %s from %j',
- process.pid,
- util.inspect(buf.toString()),
- rinfo);
-
- receivedMessages.push(buf);
-
- process.send({ message: buf.toString() });
-
- if (receivedMessages.length == messages.length) {
- process.nextTick(function() {
- listenSocket.close();
- });
- }
- });
-
- listenSocket.on('close', function() {
- //HACK: Wait to exit the process to ensure that the parent
- //process has had time to receive all messages via process.send()
- //This may be indicitave of some other issue.
- setTimeout(function() {
- process.exit();
- }, 1000);
- });
-
- listenSocket.on('listening', function() {
- process.send({ listening: true });
- });
-
- listenSocket.bind(common.PORT);
-}
diff --git a/test/simple/test-fs-readfile-error.js b/test/simple/test-fs-readfile-error.js
deleted file mode 100644
index 97d2f06..0000000
--- a/test/simple/test-fs-readfile-error.js
+++ /dev/null
@@ -1,64 +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.
-
-var common = require('../common');
-var assert = require('assert');
-var exec = require('child_process').exec;
-var path = require('path');
-
-var callbacks = 0;
-
-function test(env, cb) {
- var filename = path.join(common.fixturesDir, 'test-fs-readfile-error.js');
- var execPath = process.execPath + ' --throw-deprecation ' + filename;
- var options = { env: env || {} };
- exec(execPath, options, function(err, stdout, stderr) {
- assert(err);
- assert.equal(stdout, '');
- assert.notEqual(stderr, '');
- cb('' + stderr);
- });
-}
-
-test({ NODE_DEBUG: '' }, function(data) {
- assert(/EISDIR/.test(data));
- assert(!/test-fs-readfile-error/.test(data));
- callbacks++;
-});
-
-test({ NODE_DEBUG: 'fs' }, function(data) {
- assert(/EISDIR/.test(data));
- assert(/test-fs-readfile-error/.test(data));
- callbacks++;
-});
-
-process.on('exit', function() {
- assert.equal(callbacks, 2);
-});
-
-(function() {
- console.error('the warnings are normal here.');
- // just make sure that this doesn't crash the process.
- var fs = require('fs');
- fs.readFile(__dirname);
- fs.readdir(__filename);
- fs.unlink('gee-i-sure-hope-this-file-isnt-important-or-existing');
-})();
diff --git a/test/simple/test-http-curl-chunk-problem.js b/test/simple/test-http-curl-chunk-problem.js
deleted file mode 100644
index 5b1cb0b..0000000
--- a/test/simple/test-http-curl-chunk-problem.js
+++ /dev/null
@@ -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.
-
-if (!process.versions.openssl) {
- console.error('Skipping because node compiled without OpenSSL.');
- process.exit(0);
-}
-
-// http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919
-var common = require('../common');
-var assert = require('assert');
-var http = require('http');
-var cp = require('child_process');
-var fs = require('fs');
-
-var filename = require('path').join(common.tmpDir, 'big');
-
-var count = 0;
-function maybeMakeRequest() {
- if (++count < 2) return;
- console.log('making curl request');
- var cmd = 'curl http://127.0.0.1:' + common.PORT + '/ | openssl sha1';
- cp.exec(cmd, function(err, stdout, stderr) {
- if (err) throw err;
- var hex = stdout.match(/([A-Fa-f0-9]{40})/)[0];
- assert.equal('8c206a1a87599f532ce68675536f0b1546900d7a', hex);
- console.log('got the correct response');
- fs.unlink(filename);
- server.close();
- });
-}
-
-
-var ddcmd = common.ddCommand(filename, 10240);
-console.log('dd command: ', ddcmd);
-
-cp.exec(ddcmd, function(err, stdout, stderr) {
- if (err) throw err;
- maybeMakeRequest();
-});
-
-
-var server = http.createServer(function(req, res) {
- res.writeHead(200);
-
- // Create the subprocess
- var cat = cp.spawn('cat', [filename]);
-
- // Stream the data through to the response as binary chunks
- cat.stdout.on('data', function(data) {
- res.write(data);
- });
-
- // End the response on exit (and log errors)
- cat.on('exit', function(code) {
- if (code !== 0) {
- console.error('subprocess exited with code ' + code);
- exit(1);
- }
- res.end();
- });
-
-});
-
-server.listen(common.PORT, maybeMakeRequest);
-
-console.log('Server running at http://localhost:8080');
diff --git a/test/simple/test-http-many-keep-alive-connections.js b/test/simple/test-http-many-keep-alive-connections.js
deleted file mode 100644
index adbebbd..0000000
--- a/test/simple/test-http-many-keep-alive-connections.js
+++ /dev/null
@@ -1,69 +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.
-
-var common = require('../common');
-var assert = require('assert');
-var http = require('http');
-
-var expected = 10000;
-var responses = 0;
-var requests = 0;
-var connection;
-
-var server = http.Server(function(req, res) {
- requests++;
- assert.equal(req.connection, connection);
- res.writeHead(200);
- res.end('hello world\n');
-});
-
-server.once('connection', function(c) {
- connection = c;
-});
-
-server.listen(common.PORT, function() {
- var callee = arguments.callee;
- var request = http.get({
- port: common.PORT,
- path: '/',
- headers: {
- 'Connection': 'Keep-alive'
- }
- }, function(res) {
- res.on('end', function() {
- if (++responses < expected) {
- callee();
- } else {
- server.close();
- }
- });
- res.resume();
- }).on('error', function(e) {
- console.log(e.message);
- process.exit(1);
- });
- request.agent.maxSockets = 1;
-});
-
-process.on('exit', function() {
- assert.equal(expected, responses);
- assert.equal(expected, requests);
-});
diff --git a/test/simple/test-net-GH-5504.js b/test/simple/test-net-GH-5504.js
deleted file mode 100644
index d5059f0..0000000
--- a/test/simple/test-net-GH-5504.js
+++ /dev/null
@@ -1,123 +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.
-
-var common = require('../common');
-var assert = require('assert');
-
-// this test only fails with CentOS 6.3 using kernel version 2.6.32
-// On other linuxes and darwin, the `read` call gets an ECONNRESET in
-// that case. On sunos, the `write` call fails with EPIPE.
-//
-// However, old CentOS will occasionally send an EOF instead of a
-// ECONNRESET or EPIPE when the client has been destroyed abruptly.
-//
-// Make sure we don't keep trying to write or read more in that case.
-
-switch (process.argv[2]) {
- case 'server': return server();
- case 'client': return client();
- case undefined: return parent();
- default: throw new Error('wtf');
-}
-
-function server() {
- var net = require('net');
- var content = new Buffer(64 * 1024 * 1024);
- content.fill('#');
- net.createServer(function(socket) {
- this.close();
- socket.on('end', function() {
- console.error('end');
- });
- socket.on('_socketEnd', function() {
- console.error('_socketEnd');
- });
- socket.write(content);
- }).listen(3000, function() {
- console.log('listening');
- });
-}
-
-function client() {
- var net = require('net');
- var client = net.connect({
- host: 'localhost',
- port: 3000
- }, function() {
- client.destroy();
- });
-}
-
-function parent() {
- var spawn = require('child_process').spawn;
- var node = process.execPath;
- var assert = require('assert');
- var serverExited = false;
- var clientExited = false;
- var serverListened = false;
- var opt = { env: { NODE_DEBUG: 'net' } };
-
- process.on('exit', function() {
- assert(serverExited);
- assert(clientExited);
- assert(serverListened);
- console.log('ok');
- });
-
- setTimeout(function() {
- if (s) s.kill();
- if (c) c.kill();
- setTimeout(function() {
- throw new Error('hang');
- });
- }, 1000).unref();
-
- var s = spawn(node, [__filename, 'server'], opt);
- var c;
-
- wrap(s.stderr, process.stderr, 'SERVER 2>');
- wrap(s.stdout, process.stdout, 'SERVER 1>');
- s.on('exit', function(c) {
- console.error('server exited', c);
- serverExited = true;
- });
-
- s.stdout.once('data', function() {
- serverListened = true;
- c = spawn(node, [__filename, 'client']);
- wrap(c.stderr, process.stderr, 'CLIENT 2>');
- wrap(c.stdout, process.stdout, 'CLIENT 1>');
- c.on('exit', function(c) {
- console.error('client exited', c);
- clientExited = true;
- });
- });
-
- function wrap(inp, out, w) {
- inp.setEncoding('utf8');
- inp.on('data', function(c) {
- c = c.trim();
- if (!c) return;
- out.write(w + c.split('\n').join('\n' + w) + '\n');
- });
- }
-}
-
diff --git a/test/simple/test-setproctitle.js b/test/simple/test-setproctitle.js
deleted file mode 100644
index 6373af4..0000000
--- a/test/simple/test-setproctitle.js
+++ /dev/null
@@ -1,52 +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.
-
-// Original test written by Jakub Lekstan <kuebzky@gmail.com>
-
-// FIXME add sunos support
-if ('linux freebsd darwin'.indexOf(process.platform) === -1) {
- console.error('Skipping test, platform not supported.');
- process.exit();
-}
-
-var common = require('../common');
-var assert = require('assert');
-var exec = require('child_process').exec;
-
-// The title shouldn't be too long; libuv's uv_set_process_title() out of
-// security considerations no longer overwrites envp, only argv, so the
-// maximum title length is possibly quite short.
-var title = 'testme';
-
-assert.notEqual(process.title, title);
-process.title = title;
-assert.equal(process.title, title);
-
-exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
- assert.equal(error, null);
- assert.equal(stderr, '');
-
- // freebsd always add ' (procname)' to the process title
- if (process.platform === 'freebsd') title += ' (node)';
-
- // omitting trailing whitespace and \n
- assert.equal(stdout.replace(/\s+$/, ''), title);
-});
diff --git a/test/simple/test-stdout-close-unref.js b/test/simple/test-stdout-close-unref.js
deleted file mode 100644
index 42f3997..0000000
--- a/test/simple/test-stdout-close-unref.js
+++ /dev/null
@@ -1,24 +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.
-
-process.stdin.resume();
-process.stdin._handle.close();
-process.stdin._handle.unref(); // Should not segfault.
diff --git a/test/simple/test-timers-ordering.js b/test/simple/test-timers-ordering.js
deleted file mode 100644
index 0a32d48..0000000
--- a/test/simple/test-timers-ordering.js
+++ /dev/null
@@ -1,48 +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.
-
-var common = require('../common');
-var assert = require('assert');
-var i;
-
-var N = 30;
-
-var last_i = 0;
-var last_ts = 0;
-var start = Date.now();
-
-var f = function(i) {
- if (i <= N) {
- // check order
- assert.equal(i, last_i + 1, 'order is broken: ' + i + ' != ' + last_i + ' + 1');
- last_i = i;
-
- // check that this iteration is fired at least 1ms later than the previous
- var now = Date.now();
- console.log(i, now);
- assert(now >= last_ts + 1, 'current ts ' + now + ' < prev ts ' + last_ts + ' + 1');
- last_ts = now;
-
- // schedule next iteration
- setTimeout(f, 1, i + 1);
- }
-};
-f(1);
diff --git a/test/simple/test-tls-securepair-client.js b/test/simple/test-tls-securepair-client.js
deleted file mode 100644
index e361a14..0000000
--- a/test/simple/test-tls-securepair-client.js
+++ /dev/null
@@ -1,201 +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.
-
-if (!process.versions.openssl) {
- console.error('Skipping because node compiled without OpenSSL.');
- process.exit(0);
-}
-
-var common = require('../common');
-var join = require('path').join;
-var net = require('net');
-var assert = require('assert');
-var fs = require('fs');
-var crypto = require('crypto');
-var tls = require('tls');
-var exec = require('child_process').exec;
-var spawn = require('child_process').spawn;
-
-maybe(test1);
-
-// There is a bug with 'openssl s_server' which makes it not flush certain
-// important events to stdout when done over a pipe. Therefore we skip this
-// test for all openssl versions less than 1.0.0.
-function maybe(cb) {
- exec('openssl version', function(err, data) {
- if (err) throw err;
- if (/OpenSSL 0\./.test(data)) {
- console.error('Skipping due to old OpenSSL version.');
- return;
- }
- cb();
- });
-}
-
-// simple/test-tls-securepair-client
-function test1() {
- test('agent.key', 'agent.crt', null, test2);
-}
-
-// simple/test-tls-ext-key-usage
-function test2() {
- function check(pair) {
- // "TLS Web Client Authentication"
- assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage.length, 1);
- assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0],
- '1.3.6.1.5.5.7.3.2');
- }
- test('keys/agent4-key.pem', 'keys/agent4-cert.pem', check);
-}
-
-function test(keyfn, certfn, check, next) {
- // FIXME: Avoid the common PORT as this test currently hits a C-level
- // assertion error with node_g. The program aborts without HUPing
- // the openssl s_server thus causing many tests to fail with
- // EADDRINUSE.
- var PORT = common.PORT + 5;
-
- var connections = 0;
-
- keyfn = join(common.fixturesDir, keyfn);
- var key = fs.readFileSync(keyfn).toString();
-
- certfn = join(common.fixturesDir, certfn);
- var cert = fs.readFileSync(certfn).toString();
-
- var server = spawn('openssl', ['s_server',
- '-accept', PORT,
- '-cert', certfn,
- '-key', keyfn]);
- server.stdout.pipe(process.stdout);
- server.stderr.pipe(process.stdout);
-
-
- var state = 'WAIT-ACCEPT';
-
- var serverStdoutBuffer = '';
- server.stdout.setEncoding('utf8');
- server.stdout.on('data', function(s) {
- serverStdoutBuffer += s;
- console.error(state);
- switch (state) {
- case 'WAIT-ACCEPT':
- if (/ACCEPT/g.test(serverStdoutBuffer)) {
- // Give s_server half a second to start up.
- setTimeout(startClient, 500);
- state = 'WAIT-HELLO';
- }
- break;
-
- case 'WAIT-HELLO':
- if (/hello/g.test(serverStdoutBuffer)) {
-
- // End the current SSL connection and exit.
- // See s_server(1ssl).
- server.stdin.write('Q');
-
- state = 'WAIT-SERVER-CLOSE';
- }
- break;
-
- default:
- break;
- }
- });
-
-
- var timeout = setTimeout(function() {
- server.kill();
- process.exit(1);
- }, 5000);
-
- var gotWriteCallback = false;
- var serverExitCode = -1;
-
- server.on('exit', function(code) {
- serverExitCode = code;
- clearTimeout(timeout);
- if (next) next();
- });
-
-
- function startClient() {
- var s = new net.Stream();
-
- var sslcontext = crypto.createCredentials({key: key, cert: cert});
- sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
-
- var pair = tls.createSecurePair(sslcontext, false);
-
- assert.ok(pair.encrypted.writable);
- assert.ok(pair.cleartext.writable);
-
- pair.encrypted.pipe(s);
- s.pipe(pair.encrypted);
-
- s.connect(PORT);
-
- s.on('connect', function() {
- console.log('client connected');
- });
-
- pair.on('secure', function() {
- console.log('client: connected+secure!');
- console.log('client pair.cleartext.getPeerCertificate(): %j',
- pair.cleartext.getPeerCertificate());
- console.log('client pair.cleartext.getCipher(): %j',
- pair.cleartext.getCipher());
- if (check) check(pair);
- setTimeout(function() {
- pair.cleartext.write('hello\r\n', function() {
- gotWriteCallback = true;
- });
- }, 500);
- });
-
- pair.cleartext.on('data', function(d) {
- console.log('cleartext: %s', d.toString());
- });
-
- s.on('close', function() {
- console.log('client close');
- });
-
- pair.encrypted.on('error', function(err) {
- console.log('encrypted error: ' + err);
- });
-
- s.on('error', function(err) {
- console.log('socket error: ' + err);
- });
-
- pair.on('error', function(err) {
- console.log('secure error: ' + err);
- });
- }
-
-
- process.on('exit', function() {
- assert.equal(0, serverExitCode);
- assert.equal('WAIT-SERVER-CLOSE', state);
- assert.ok(gotWriteCallback);
- });
-}
diff --git a/test/simple/test-tls-securepair-server.js b/test/simple/test-tls-securepair-server.js
deleted file mode 100644
index 3b4eec1..0000000
--- a/test/simple/test-tls-securepair-server.js
+++ /dev/null
@@ -1,154 +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.
-
-if (!process.versions.openssl) {
- console.error('Skipping because node compiled without OpenSSL.');
- process.exit(0);
-}
-
-
-var common = require('../common');
-var assert = require('assert');
-
-var join = require('path').join;
-var net = require('net');
-var fs = require('fs');
-var crypto = require('crypto');
-var tls = require('tls');
-var spawn = require('child_process').spawn;
-
-var connections = 0;
-var key = fs.readFileSync(join(common.fixturesDir, 'agent.key')).toString();
-var cert = fs.readFileSync(join(common.fixturesDir, 'agent.crt')).toString();
-
-function log(a) {
- console.error('***server*** ' + a);
-}
-
-var server = net.createServer(function(socket) {
- connections++;
- log('connection fd=' + socket.fd);
- var sslcontext = crypto.createCredentials({key: key, cert: cert});
- sslcontext.context.setCiphers('RC4-SHA:AES128-SHA:AES256-SHA');
-
- var pair = tls.createSecurePair(sslcontext, true);
-
- assert.ok(pair.encrypted.writable);
- assert.ok(pair.cleartext.writable);
-
- pair.encrypted.pipe(socket);
- socket.pipe(pair.encrypted);
-
- log('i set it secure');
-
- pair.on('secure', function() {
- log('connected+secure!');
- pair.cleartext.write('hello\r\n');
- log(pair.cleartext.getPeerCertificate());
- log(pair.cleartext.getCipher());
- });
-
- pair.cleartext.on('data', function(data) {
- log('read bytes ' + data.length);
- pair.cleartext.write(data);
- });
-
- socket.on('end', function() {
- log('socket end');
- });
-
- pair.cleartext.on('error', function(err) {
- log('got error: ');
- log(err);
- log(err.stack);
- socket.destroy();
- });
-
- pair.encrypted.on('error', function(err) {
- log('encrypted error: ');
- log(err);
- log(err.stack);
- socket.destroy();
- });
-
- socket.on('error', function(err) {
- log('socket error: ');
- log(err);
- log(err.stack);
- socket.destroy();
- });
-
- socket.on('close', function(err) {
- log('socket closed');
- });
-
- pair.on('error', function(err) {
- log('secure error: ');
- log(err);
- log(err.stack);
- socket.destroy();
- });
-});
-
-var gotHello = false;
-var sentWorld = false;
-var gotWorld = false;
-var opensslExitCode = -1;
-
-server.listen(common.PORT, function() {
- // To test use: openssl s_client -connect localhost:8000
- var client = spawn('openssl', ['s_client', '-connect', '127.0.0.1:' +
- common.PORT]);
-
-
- var out = '';
-
- client.stdout.setEncoding('utf8');
- client.stdout.on('data', function(d) {
- out += d;
-
- if (!gotHello && /hello/.test(out)) {
- gotHello = true;
- client.stdin.write('world\r\n');
- sentWorld = true;
- }
-
- if (!gotWorld && /world/.test(out)) {
- gotWorld = true;
- client.stdin.end();
- }
- });
-
- client.stdout.pipe(process.stdout, { end: false });
-
- client.on('exit', function(code) {
- opensslExitCode = code;
- server.close();
- });
-});
-
-process.on('exit', function() {
- assert.equal(1, connections);
- assert.ok(gotHello);
- assert.ok(sentWorld);
- assert.ok(gotWorld);
- assert.equal(0, opensslExitCode);
-});
diff --git a/test/simple/test-tls-set-ciphers.js b/test/simple/test-tls-set-ciphers.js
deleted file mode 100644
index a473a1d..0000000
--- a/test/simple/test-tls-set-ciphers.js
+++ /dev/null
@@ -1,62 +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.
-
-var common = require('../common');
-var assert = require('assert');
-var exec = require('child_process').exec;
-var tls = require('tls');
-var fs = require('fs');
-
-if (process.platform === 'win32') {
- console.log("Skipping test, you probably don't have openssl installed.");
- process.exit();
-}
-
-var options = {
- key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'),
- cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'),
- ciphers: 'RC4-MD5'
-};
-
-var reply = 'I AM THE WALRUS'; // something recognizable
-var nconns = 0;
-var response = '';
-
-process.on('exit', function() {
- assert.equal(nconns, 1);
- assert.notEqual(response.indexOf(reply), -1);
-});
-
-var server = tls.createServer(options, function(conn) {
- conn.end(reply);
- nconns++;
-});
-
-server.listen(common.PORT, '127.0.0.1', function() {
- var cmd = 'openssl s_client -cipher ' + options.ciphers +
- ' -connect 127.0.0.1:' + common.PORT;
-
- exec(cmd, function(err, stdout, stderr) {
- if (err) throw err;
- response = stdout;
- server.close();
- });
-});
--
1.8.3.1