Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: split simple into io/simple, run in parallel #172

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tags
*.pyc
doc/api.xml
tmp/
test/tmp*/
node
node_g
*.swp
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,18 @@ distclean:
-rm -rf node_modules

test: all
$(PYTHON) tools/test.py --mode=release simple message
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
$(MAKE) jslint
$(MAKE) cpplint

test-parallel: all
$(PYTHON) tools/test.py --mode=release parallel -J

test-http1: all
$(PYTHON) tools/test.py --mode=release --use-http1 simple message
$(PYTHON) tools/test.py --mode=release --use-http1 sequential parallel message

test-valgrind: all
$(PYTHON) tools/test.py --mode=release --valgrind simple message
$(PYTHON) tools/test.py --mode=release --valgrind sequential parallel message

test/gc/node_modules/weak/build/Release/weakref.node:
@if [ ! -f $(NODE_EXE) ]; then make all; fi
Expand Down Expand Up @@ -141,7 +144,7 @@ test-message: test-build
$(PYTHON) tools/test.py message

test-simple: all
$(PYTHON) tools/test.py simple
$(PYTHON) tools/test.py parallel sequential

test-pummel: all wrk
$(PYTHON) tools/test.py pummel
Expand Down
11 changes: 10 additions & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ var os = require('os');
exports.testDir = path.dirname(__filename);
exports.fixturesDir = path.join(exports.testDir, 'fixtures');
exports.libDir = path.join(exports.testDir, '../lib');
exports.tmpDir = path.join(exports.testDir, 'tmp');
exports.tmpDirName = 'tmp';
exports.PORT = +process.env.NODE_COMMON_PORT || 12346;

if (process.env.TEST_THREAD_ID) {
// Distribute ports in parallel tests
if (!process.env.NODE_COMMON_PORT)
exports.PORT += +process.env.TEST_THREAD_ID * 100;

exports.tmpDirName += '.' + process.env.TEST_THREAD_ID;
}
exports.tmpDir = path.join(exports.testDir, exports.tmpDirName);

exports.opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
if (process.platform === 'win32') {
exports.PIPE = '\\\\.\\pipe\\libuv-test';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
var assert = require('assert');
var net = require('net');
var util = require('util');
var common = require('../common');
var revivals = 0;
var deaths = 0;

Expand Down Expand Up @@ -49,7 +50,7 @@ function tryTimer() {
function tryListen() {
console.log('create a server');
net.createServer()
.listen(0)
.listen(common.PORT)
.on('listening', function() {
revivals++;
this.close();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ child.exec(nodejs + ' --eval "require(\'' + filename + '\')"',
});

// module path resolve bug, regression test
child.exec(nodejs + ' --eval "require(\'./test/simple/test-cli-eval.js\')"',
child.exec(nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"',
function(status, stdout, stderr) {
assert.equal(status.code, 42);
});
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
var assert = require('assert');
var cluster = require('cluster')
var net = require('net');
var common = require('../common');

var destroyed;
var success;
Expand Down Expand Up @@ -53,7 +54,7 @@ if (cluster.isMaster) {
success = true;
});

}).listen(0, function() {
}).listen(common.PORT, function() {
var port = this.address().port;

worker = cluster.fork()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var assert = require('assert');

var fs = require('fs'),
dgram = require('dgram'), server, client,
server_port = 20989,
server_port = common.PORT,
message_to_send = 'A message to send',
timer;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function test_simple_relative_symlink(callback) {
var entry = common.tmpDir + '/symlink',
expected = common.tmpDir + '/cycles/root.js';
[
[entry, '../tmp/cycles/root.js']
[entry, '../' + common.tmpDirName + '/cycles/root.js']
].forEach(function(t) {
try {fs.unlinkSync(t[0]);}catch (e) {}
console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file');
Expand Down Expand Up @@ -335,15 +335,16 @@ function test_deep_symlink_mix(callback) {
fs.mkdirSync(tmp('node-test-realpath-d2'), 0700);
try {
[
[entry, '../tmp/node-test-realpath-d1/foo'],
[tmp('node-test-realpath-d1'), '../tmp/node-test-realpath-d2'],
[entry, '../' + common.tmpDirName + '/node-test-realpath-d1/foo'],
[tmp('node-test-realpath-d1'),
'../' + common.tmpDirName + '/node-test-realpath-d2'],
[tmp('node-test-realpath-d2/foo'), '../node-test-realpath-f2'],
[tmp('node-test-realpath-f2'), fixturesAbsDir +
'/nested-index/one/realpath-c'],
[fixturesAbsDir + '/nested-index/one/realpath-c', fixturesAbsDir +
'/nested-index/two/realpath-c'],
[fixturesAbsDir + '/nested-index/two/realpath-c',
'../../../tmp/cycles/root.js']
'../../../' + common.tmpDirName + '/cycles/root.js']
].forEach(function(t) {
//common.debug('setting up '+t[0]+' -> '+t[1]);
try { fs.unlinkSync(t[0]); } catch (e) {}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var assert = require('assert'),
common = require('../common'),
http = require('http');

var complete;
Expand All @@ -38,7 +39,7 @@ var server = http.createServer(function (req, res) {
});


server.listen(0, function () {
server.listen(common.PORT, function () {
console.log('listen', server.address().port);

var agent = new http.Agent({maxSockets: 1});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ process.on('exit', function() {
var server = http.createServer(function(req, res) {
request++;
res.end();
}).listen(function() {
}).listen(common.PORT, function() {
var options = {
agent: null,
port: this.address().port
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading