diff options
author | Brian White <mscdex@mscdex.net> | 2015-03-25 02:26:21 -0400 |
---|---|---|
committer | Brian White <mscdex@mscdex.net> | 2015-04-03 00:56:45 -0400 |
commit | a081c7c5222de844ed0a61d470b8334676249d66 (patch) | |
tree | 7d73dd3adfa2f5b7dbf53801ecd4c96a38315c56 | |
parent | f1e5a13516d1b7472206fad8c4c20c249c60f1db (diff) | |
download | android-node-v8-a081c7c5222de844ed0a61d470b8334676249d66.tar.gz android-node-v8-a081c7c5222de844ed0a61d470b8334676249d66.tar.bz2 android-node-v8-a081c7c5222de844ed0a61d470b8334676249d66.zip |
benchmark: fix chunky client benchmark execution
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: https://github.com/iojs/io.js/pull/1257
Reviewed-By: Roman Reiss <me@silverwind.io>
-rw-r--r-- | benchmark/http/_chunky_http_client.js (renamed from benchmark/net/chunky_http_client.js) | 0 | ||||
-rw-r--r-- | benchmark/http/http_server_for_chunky_client.js (renamed from benchmark/net/http_server_for_chunky_client.js) | 13 |
2 files changed, 10 insertions, 3 deletions
diff --git a/benchmark/net/chunky_http_client.js b/benchmark/http/_chunky_http_client.js index 24e14ca2bc..24e14ca2bc 100644 --- a/benchmark/net/chunky_http_client.js +++ b/benchmark/http/_chunky_http_client.js diff --git a/benchmark/net/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js index 5439e7226e..dede7daa7c 100644 --- a/benchmark/net/http_server_for_chunky_client.js +++ b/benchmark/http/http_server_for_chunky_client.js @@ -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); @@ -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) { |