summaryrefslogtreecommitdiff
path: root/jstests/_runner_leak_nojni.js
blob: fe2c6b23902fa9c0cf85486c9ee5afb9d6ce4170 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// simple runner to run toplevel tests in jstests
//
var files = listFiles("jstests");

var dummyDb = db.getSisterDB( "dummyDBdummydummy" );

dummyDb.getSisterDB( "admin" ).runCommand( "closeAllDatabases" );
prev = dummyDb.runCommand( "meminfo" );

print( "START : " + tojson( prev ) );

files.forEach(
    function(x) {
        
        if ( /_runner/.test(x.name) ||
             /_lodeRunner/.test(x.name) ||
             /jni/.test(x.name) ||
             /eval/.test(x.name) ||
             /where/.test(x.name) ||
             ! /\.js$/.test(x.name ) ){ 
            print(" >>>>>>>>>>>>>>> skipping " + x.name);
            return;
        }
        
        
        print(" *******************************************");
        print("         Test : " + x.name + " ...");
        print("                " + Date.timeFunc( function() { load(x.name); }, 1) + "ms");
        
        assert( dummyDb.getSisterDB( "admin" ).runCommand( "closeAllDatabases" ).ok == 1 , "closeAllDatabases failed" );
        var now = dummyDb.runCommand( "meminfo" );
        if ( now.virtual > prev.virtual )
            print( "    LEAK : " + prev.virtual + " -->> " + now.virtual );
        prev = now;
    }
);



dummyDb.getSisterDB( "admin" ).runCommand( "closeAllDatabases" );
print( "END   : " + tojson( dummyDb.runCommand( "meminfo" ) ) );