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