diff options
author | Aaron <aaron@10gen.com> | 2009-12-22 15:08:47 -0800 |
---|---|---|
committer | Aaron <aaron@10gen.com> | 2009-12-22 15:08:47 -0800 |
commit | 8435fd5526effa9433bf3796be93e46fb38734ae (patch) | |
tree | 09de5d071291eddd8c0607666504fc62d660b116 /jstests/parallel | |
parent | d70db47d96390357b91565df295b6d061b4136d7 (diff) | |
download | mongo-8435fd5526effa9433bf3796be93e46fb38734ae.tar.gz |
SERVER-470 add fork test
Diffstat (limited to 'jstests/parallel')
-rw-r--r-- | jstests/parallel/shellfork.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/parallel/shellfork.js b/jstests/parallel/shellfork.js new file mode 100644 index 00000000000..27379506ec3 --- /dev/null +++ b/jstests/parallel/shellfork.js @@ -0,0 +1,22 @@ +a = fork( function( a, b ) { return a / b; }, 10, 2 ); +a.start(); +b = fork( function( a, b, c ) { return a + b + c; }, 18, " is a ", "multiple of 3" ); +makeFunny = function( text ) { + return text + " ha ha!"; +} +c = fork( makeFunny, "paisley" ); +c.start(); +b.start(); +b.join(); +assert.eq( 5, a.returnData() ); +assert.eq( "18 is a multiple of 3", b.returnData() ); +assert.eq( "paisley ha ha!", c.returnData() ); + +z = fork( function( a ) { + var y = fork( function( a ) { + return a + 1; }, 5 ); + y.start(); + return y.returnData() + a; + }, 1 ); +z.start(); +assert.eq( 7, z.returnData() ); |