Skip to content

Commit 4980686

Browse files
committed
Add test from v0.4 dea49e3
Note this test completes in 3 seconds on v0.4 and 7 minutes on master. NOT GOOD.
1 parent 5300829 commit 4980686

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Copyright Joyent, Inc. and other Node contributors.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a
4+
// copy of this software and associated documentation files (the
5+
// "Software"), to deal in the Software without restriction, including
6+
// without limitation the rights to use, copy, modify, merge, publish,
7+
// distribute, sublicense, and/or sell copies of the Software, and to permit
8+
// persons to whom the Software is furnished to do so, subject to the
9+
// following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included
12+
// in all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
22+
var common = require('../common');
23+
var net = require('net');
24+
var assert = require('assert');
25+
26+
var cbcount = 0;
27+
var N = 500000;
28+
29+
var server = net.Server(function(socket) {
30+
socket.on('data', function(d) {
31+
console.error("got %d bytes", d.length);
32+
});
33+
34+
socket.on('end', function() {
35+
console.error("end");
36+
socket.destroy();
37+
server.close();
38+
});
39+
});
40+
41+
server.listen(common.PORT, function() {
42+
var client = net.createConnection(common.PORT);
43+
44+
client.on('connect', function() {
45+
for (var i = 0; i < N; i++) {
46+
client.write("hello world", function() {
47+
cbcount++;
48+
});
49+
}
50+
client.end();
51+
});
52+
});
53+
54+
process.on('exit', function() {
55+
assert.equal(N, cbcount);
56+
});

0 commit comments

Comments
 (0)