Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Clean up gc tests
This fixes the additional issues brought up in #3179.
  • Loading branch information
isaacs committed May 4, 2012
1 parent e3ceee2 commit 62c12d2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
7 changes: 5 additions & 2 deletions test/gc/test-http-client-connaborted.js
Expand Up @@ -10,7 +10,7 @@ var http = require('http'),
done = 0,
count = 0,
countGC = 0,
todo = 18,
todo = 500,
common = require('../common.js'),
assert = require('assert'),
PORT = common.PORT;
Expand Down Expand Up @@ -45,8 +45,11 @@ function afterGC(){
countGC ++;
}

var timer;
function statusLater() {
setTimeout(status, 1);
gc();
if (timer) clearTimeout(timer);
timer = setTimeout(status, 1);
}

function status() {
Expand Down
7 changes: 5 additions & 2 deletions test/gc/test-http-client-onerror.js
Expand Up @@ -11,7 +11,7 @@ var http = require('http'),
done = 0,
count = 0,
countGC = 0,
todo = 18,
todo = 500,
common = require('../common.js'),
assert = require('assert'),
PORT = common.PORT;
Expand Down Expand Up @@ -49,8 +49,11 @@ function afterGC(){
countGC ++;
}

var timer;
function statusLater() {
setTimeout(status, 1);
gc();
if (timer) clearTimeout(timer);
timer = setTimeout(status, 1);
}

function status() {
Expand Down
7 changes: 5 additions & 2 deletions test/gc/test-http-client-timeout.js
Expand Up @@ -13,7 +13,7 @@ var http = require('http'),
done = 0,
count = 0,
countGC = 0,
todo = 18,
todo = 500,
common = require('../common.js'),
assert = require('assert'),
PORT = common.PORT;
Expand Down Expand Up @@ -52,8 +52,11 @@ function afterGC(){
countGC ++;
}

var timer;
function statusLater() {
setTimeout(status, 1);
gc();
if (timer) clearTimeout(timer);
timer = setTimeout(status, 1);
}

function status() {
Expand Down
8 changes: 6 additions & 2 deletions test/gc/test-http-client.js
Expand Up @@ -10,7 +10,7 @@ var http = require('http'),
done = 0,
count = 0,
countGC = 0,
todo = 5,
todo = 500,
common = require('../common.js'),
assert = require('assert'),
PORT = common.PORT;
Expand Down Expand Up @@ -47,8 +47,11 @@ function afterGC(){
countGC ++;
}

var timer;
function statusLater() {
setTimeout(status, 1);
gc();
if (timer) clearTimeout(timer);
timer = setTimeout(status, 1);
}

function status() {
Expand All @@ -61,3 +64,4 @@ function status() {
process.exit(0);
}
}

9 changes: 6 additions & 3 deletions test/gc/test-net-timeout.js
Expand Up @@ -13,7 +13,7 @@ var net = require('net'),
done = 0,
count = 0,
countGC = 0,
todo = 18,
todo = 500,
common = require('../common.js'),
assert = require('assert'),
PORT = common.PORT;
Expand All @@ -36,16 +36,19 @@ function getall() {

count++;
weak(req, afterGC);
})()
})();
}
}

function afterGC(){
countGC ++;
}

var timer;
function statusLater() {
setTimeout(status, 1);
gc();
if (timer) clearTimeout(timer);
timer = setTimeout(status, 1);
}

function status() {
Expand Down

0 comments on commit 62c12d2

Please sign in to comment.