From 24169676c46d8fd8d996d81f628f2d76c60425d9 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 29 Dec 2009 12:02:21 -0800 Subject: SERVER-470 test to run basic js tests in parallel --- jstests/parallel/basic.js | 34 ++++++++++++++++++++++++++++++++++ jstests/parallel/insert.js | 4 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 jstests/parallel/basic.js (limited to 'jstests') diff --git a/jstests/parallel/basic.js b/jstests/parallel/basic.js new file mode 100644 index 00000000000..e0f0d120ad0 --- /dev/null +++ b/jstests/parallel/basic.js @@ -0,0 +1,34 @@ +// perform basic js tests in parallel + +var files = listFiles("jstests"); +var i = 0; +var argvs = new Array( [], [], [], [] ); + +files.forEach( + function(x) { + + if ( /_runner/.test(x.name) || + /_lodeRunner/.test(x.name) || + ! /\.js$/.test(x.name ) ){ + print(" >>>>>>>>>>>>>>> skipping " + x.name); + return; + } + + argvs[ i++ % 4 ].push( x.name ); + } +); + +printjson( argvs ); + +test = function() { + var args = argumentsToArray( arguments ); + args.forEach( + function( x ) { + print(" Test : " + x + " ..."); + var time = Date.timeFunc( function() { load(x); }, 1); + print(" Test : " + x + " " + time + "ms" ); + } + ); +} + +assert.parallelTests( test, argvs, "one or more tests failed" ); diff --git a/jstests/parallel/insert.js b/jstests/parallel/insert.js index 871e6d46af0..48767f741a3 100644 --- a/jstests/parallel/insert.js +++ b/jstests/parallel/insert.js @@ -1,6 +1,6 @@ // perform inserts in parallel from several clients -f = db.jstests_parallel_basic; +f = db.jstests_parallel_insert; f.drop(); f.ensureIndex( {me:1} ); @@ -24,7 +24,7 @@ test = function( mean, me ) { } } -argvs = Array(); +argvs = new Array(); for( i = 0; i < 10; ++i ) { argvs.push( [ Math.random() * 20, i ] ); } -- cgit v1.2.1