Skip to content

Commit

Permalink
benchmark: fix chunky client benchmark execution
Browse files Browse the repository at this point in the history
This commit fixes a few things for this benchmark:

1. Ensures the temporary directory for the unix socket exists.
2. Prevents the client code from being run directly because the
server script is the one that calls out the client code.
3. Ensures the server is closed once the client benchmarks have
finished.
4. Since this is an http benchmark, it should be moved to the http
benchmarks subdirectory.

PR-URL: #1257
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
mscdex committed Apr 3, 2015
1 parent f1e5a13 commit a081c7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ var fs = require('fs');
var spawn = require('child_process').spawn;
var common = require('../common.js')
var test = require('../../test/common.js')
var pep = path.dirname(process.argv[1]) + '/chunky_http_client.js';
var pep = path.dirname(process.argv[1]) + '/_chunky_http_client.js';
var PIPE = test.PIPE;

try {
fs.accessSync(test.tmpDir, fs.F_OK);
} catch (e) {
fs.mkdirSync(test.tmpDir);
}

var server;
try {
fs.unlinkSync(PIPE);
Expand Down Expand Up @@ -36,9 +42,10 @@ try {
});

child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);

child.on('exit', function (exitCode) {
console.error('Child exited with code: ' + exitCode);
child.on('close', function (exitCode) {
server.close();
});

} catch(e) {
Expand Down

0 comments on commit a081c7c

Please sign in to comment.