Fix tests
This commit is contained in:
parent
03123435e0
commit
a8c2bb41af
@ -22,8 +22,10 @@ function runAb(opts, callback) {
|
|||||||
var command = "ab " + opts + " http://127.0.0.1:" + common.PORT + "/";
|
var command = "ab " + opts + " http://127.0.0.1:" + common.PORT + "/";
|
||||||
exec(command, function (err, stdout, stderr) {
|
exec(command, function (err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
if (stderr.indexOf("ab") >= 0) {
|
||||||
console.log("ab not installed? skipping test.\n" + stderr);
|
console.log("ab not installed? skipping test.\n" + stderr);
|
||||||
process.exit();
|
process.reallyExit(0);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
@ -43,8 +43,8 @@ function pingPongTest (port, host, on_complete) {
|
|||||||
socket.server.close();
|
socket.server.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
server.listen(port, host);
|
|
||||||
|
|
||||||
|
server.listen(port, host, function () {
|
||||||
var client = net.createConnection(port, host);
|
var client = net.createConnection(port, host);
|
||||||
|
|
||||||
client.setEncoding("utf8");
|
client.setEncoding("utf8");
|
||||||
@ -83,6 +83,7 @@ function pingPongTest (port, host, on_complete) {
|
|||||||
if (on_complete) on_complete();
|
if (on_complete) on_complete();
|
||||||
tests_run += 1;
|
tests_run += 1;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pingPongTest(common.PORT);
|
pingPongTest(common.PORT);
|
||||||
|
@ -43,8 +43,8 @@ function pingPongTest (port, host, on_complete) {
|
|||||||
socket.server.close();
|
socket.server.close();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
server.listen(port, host);
|
|
||||||
|
|
||||||
|
server.listen(port, host, function () {
|
||||||
var client = net.createConnection(port, host);
|
var client = net.createConnection(port, host);
|
||||||
|
|
||||||
client.setEncoding("utf8");
|
client.setEncoding("utf8");
|
||||||
@ -82,6 +82,7 @@ function pingPongTest (port, host, on_complete) {
|
|||||||
if (on_complete) on_complete();
|
if (on_complete) on_complete();
|
||||||
tests_run += 1;
|
tests_run += 1;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All are run at once, so run on different ports */
|
/* All are run at once, so run on different ports */
|
||||||
|
@ -3,6 +3,10 @@ assert = common.assert
|
|||||||
net = require("net");
|
net = require("net");
|
||||||
N = 160*1024; // 30kb
|
N = 160*1024; // 30kb
|
||||||
|
|
||||||
|
|
||||||
|
chars_recved = 0;
|
||||||
|
npauses = 0;
|
||||||
|
|
||||||
console.log("build big string");
|
console.log("build big string");
|
||||||
var body = "";
|
var body = "";
|
||||||
for (var i = 0; i < N; i++) {
|
for (var i = 0; i < N; i++) {
|
||||||
@ -17,13 +21,7 @@ server = net.createServer(function (connection) {
|
|||||||
connection.end();
|
connection.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
server.listen(common.PORT);
|
server.listen(common.PORT, function () {
|
||||||
|
|
||||||
|
|
||||||
chars_recved = 0;
|
|
||||||
npauses = 0;
|
|
||||||
|
|
||||||
|
|
||||||
var paused = false;
|
var paused = false;
|
||||||
client = net.createConnection(common.PORT);
|
client = net.createConnection(common.PORT);
|
||||||
client.setEncoding("ascii");
|
client.setEncoding("ascii");
|
||||||
@ -49,6 +47,9 @@ client.addListener("end", function () {
|
|||||||
server.close();
|
server.close();
|
||||||
client.end();
|
client.end();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
process.addListener("exit", function () {
|
process.addListener("exit", function () {
|
||||||
assert.equal(N, chars_recved);
|
assert.equal(N, chars_recved);
|
||||||
|
@ -23,7 +23,10 @@ function runAb(opts, callback) {
|
|||||||
var command = "ab " + opts + " http://127.0.0.1:" + common.PORT + "/";
|
var command = "ab " + opts + " http://127.0.0.1:" + common.PORT + "/";
|
||||||
exec(command, function (err, stdout, stderr) {
|
exec(command, function (err, stdout, stderr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
if (stderr.indexOf("ab") >= 0) {
|
||||||
console.log("ab not installed? skipping test.\n" + stderr);
|
console.log("ab not installed? skipping test.\n" + stderr);
|
||||||
|
process.reallyExit(0);
|
||||||
|
}
|
||||||
process.exit();
|
process.exit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user