summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorYosuke Furukawa <yosuke.furukawa@gmail.com>2015-01-18 00:33:07 +0900
committerBen Noordhuis <info@bnoordhuis.nl>2015-01-17 17:13:07 +0100
commitea7750bddd8051f39fa538905e05f9bf1d1afa5f (patch)
tree9757056f0be861efb0f697ba1e408c00274487c8 /benchmark
parent4764eef9b2efdf17cafeb4ec40898c6669a84e3b (diff)
downloadnodejs-ea7750bddd8051f39fa538905e05f9bf1d1afa5f.tar.gz
nodejs-ea7750bddd8051f39fa538905e05f9bf1d1afa5f.tar.bz2
nodejs-ea7750bddd8051f39fa538905e05f9bf1d1afa5f.zip
benchmark: add filter option for benchmark
Before: # common.js executes all tests in net directory. $ ./iojs common.js net After: # common.js executes only "dgram" tests in net directory. $ ./iojs common.js net dgram PR-URL: https://github.com/iojs/io.js/pull/488 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/common.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/benchmark/common.js b/benchmark/common.js
index 825bfb43f..a6a1d87af 100644
--- a/benchmark/common.js
+++ b/benchmark/common.js
@@ -7,8 +7,9 @@ exports.PORT = process.env.PORT || 12346;
// If this is the main module, then run the benchmarks
if (module === require.main) {
var type = process.argv[2];
+ var testFilter = process.argv[3];
if (!type) {
- console.error('usage:\n ./iojs benchmark/common.js <type>');
+ console.error('usage:\n ./iojs benchmark/common.js <type> [testFilter]');
process.exit(1);
}
@@ -17,6 +18,19 @@ if (module === require.main) {
var tests = fs.readdirSync(dir);
var spawn = require('child_process').spawn;
+ if (testFilter) {
+ var filteredTests = tests.filter(function(item){
+ if (item.lastIndexOf(testFilter) >= 0) {
+ return item;
+ }
+ });
+ if (filteredTests.length === 0) {
+ console.error(`${testFilter} is not found in \n ${tests.join(' \n')}`);
+ return;
+ }
+ tests = filteredTests;
+ }
+
runBenchmarks();
}