mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Allow turning off journaling at smoke.py command line to make tests run faster and not preallocate
This commit is contained in:
parent
9561aabe7c
commit
53965e6f03
@ -149,6 +149,8 @@ class mongod(object):
|
|||||||
argv += ["--master", "--oplogSize", "256"]
|
argv += ["--master", "--oplogSize", "256"]
|
||||||
if self.slave:
|
if self.slave:
|
||||||
argv += ['--slave', '--source', 'localhost:' + str(srcport)]
|
argv += ['--slave', '--source', 'localhost:' + str(srcport)]
|
||||||
|
if self.kwargs.get('no_journal'):
|
||||||
|
argv += ['--nojournal']
|
||||||
print "running " + " ".join(argv)
|
print "running " + " ".join(argv)
|
||||||
self.proc = Popen(argv)
|
self.proc = Popen(argv)
|
||||||
if not self.did_mongod_start(self.port):
|
if not self.did_mongod_start(self.port):
|
||||||
@ -285,7 +287,8 @@ def runTest(test):
|
|||||||
argv = argv + [ '--eval', 'TestData = new Object();' +
|
argv = argv + [ '--eval', 'TestData = new Object();' +
|
||||||
'TestData.testPath = "' + path + '";' +
|
'TestData.testPath = "' + path + '";' +
|
||||||
'TestData.testFile = "' + os.path.basename( path ) + '";' +
|
'TestData.testFile = "' + os.path.basename( path ) + '";' +
|
||||||
'TestData.testName = "' + re.sub( ".js$", "", os.path.basename( path ) ) + '";' ]
|
'TestData.testName = "' + re.sub( ".js$", "", os.path.basename( path ) ) + '";' +
|
||||||
|
'TestData.noJournal = ' + ( 'true' if no_journal else 'false' ) + ";" ]
|
||||||
print argv
|
print argv
|
||||||
r = call(argv, cwd=test_path)
|
r = call(argv, cwd=test_path)
|
||||||
t2 = time.time()
|
t2 = time.time()
|
||||||
@ -308,7 +311,7 @@ def run_tests(tests):
|
|||||||
|
|
||||||
# The reason we use with is so that we get __exit__ semantics
|
# The reason we use with is so that we get __exit__ semantics
|
||||||
|
|
||||||
with mongod(small_oplog=small_oplog) as master:
|
with mongod(small_oplog=small_oplog,no_journal=no_journal) as master:
|
||||||
with mongod(slave=True) if small_oplog else Nothing() as slave:
|
with mongod(slave=True) if small_oplog else Nothing() as slave:
|
||||||
if small_oplog:
|
if small_oplog:
|
||||||
master.wait_for_repl()
|
master.wait_for_repl()
|
||||||
@ -428,7 +431,7 @@ def add_exe(e):
|
|||||||
return e
|
return e
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global mongod_executable, mongod_port, shell_executable, continue_on_failure, small_oplog, smoke_db_prefix, test_path
|
global mongod_executable, mongod_port, shell_executable, continue_on_failure, small_oplog, no_journal, smoke_db_prefix, test_path
|
||||||
parser = OptionParser(usage="usage: smoke.py [OPTIONS] ARGS*")
|
parser = OptionParser(usage="usage: smoke.py [OPTIONS] ARGS*")
|
||||||
parser.add_option('--mode', dest='mode', default='suite',
|
parser.add_option('--mode', dest='mode', default='suite',
|
||||||
help='If "files", ARGS are filenames; if "suite", ARGS are sets of tests (%default)')
|
help='If "files", ARGS are filenames; if "suite", ARGS are sets of tests (%default)')
|
||||||
@ -454,6 +457,9 @@ def main():
|
|||||||
parser.add_option('--small-oplog', dest='small_oplog', default=False,
|
parser.add_option('--small-oplog', dest='small_oplog', default=False,
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help='Run tests with master/slave replication & use a small oplog')
|
help='Run tests with master/slave replication & use a small oplog')
|
||||||
|
parser.add_option('--nojournal', dest='no_journal', default=False,
|
||||||
|
action="store_true",
|
||||||
|
help='Do not turn on journaling in tests')
|
||||||
global tests
|
global tests
|
||||||
(options, tests) = parser.parse_args()
|
(options, tests) = parser.parse_args()
|
||||||
|
|
||||||
@ -474,6 +480,7 @@ def main():
|
|||||||
continue_on_failure = options.continue_on_failure
|
continue_on_failure = options.continue_on_failure
|
||||||
smoke_db_prefix = options.smoke_db_prefix
|
smoke_db_prefix = options.smoke_db_prefix
|
||||||
small_oplog = options.small_oplog
|
small_oplog = options.small_oplog
|
||||||
|
no_journal = options.no_journal
|
||||||
|
|
||||||
if options.File:
|
if options.File:
|
||||||
if options.File == '-':
|
if options.File == '-':
|
||||||
|
@ -79,6 +79,8 @@ startMongodTest = function (port, dirname, restart, extraOptions ) {
|
|||||||
oplogSize: "40",
|
oplogSize: "40",
|
||||||
nohttpinterface: ""
|
nohttpinterface: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if( jsTestOptions().noJournal ) options["nojournal"] = ""
|
||||||
|
|
||||||
if ( extraOptions )
|
if ( extraOptions )
|
||||||
Object.extend( options , extraOptions );
|
Object.extend( options , extraOptions );
|
||||||
@ -917,6 +919,7 @@ ReplTest.prototype.getOptions = function( master , extra , putBinaryFirst, norep
|
|||||||
a.push( "--dbpath" );
|
a.push( "--dbpath" );
|
||||||
a.push( this.getPath( master ) );
|
a.push( this.getPath( master ) );
|
||||||
|
|
||||||
|
if( jsTestOptions().noJournal ) a.push( "--nojournal" )
|
||||||
|
|
||||||
if ( !norepl ) {
|
if ( !norepl ) {
|
||||||
if ( master ){
|
if ( master ){
|
||||||
@ -1225,6 +1228,8 @@ ReplSetTest.prototype.getOptions = function( n , extra , putBinaryFirst ){
|
|||||||
a.push( "--dbpath" );
|
a.push( "--dbpath" );
|
||||||
a.push( this.getPath( ( n.host ? this.getNodeId( n ) : n ) ) );
|
a.push( this.getPath( ( n.host ? this.getNodeId( n ) : n ) ) );
|
||||||
|
|
||||||
|
if( jsTestOptions.noJournal ) a.push( "--nojournal" )
|
||||||
|
|
||||||
for ( var k in extra ){
|
for ( var k in extra ){
|
||||||
var v = extra[k];
|
var v = extra[k];
|
||||||
a.push( "--" + k );
|
a.push( "--" + k );
|
||||||
|
@ -969,6 +969,11 @@ jsTestPath = function(){
|
|||||||
return "__unknown_path__"
|
return "__unknown_path__"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jsTestOptions = function(){
|
||||||
|
if( TestData ) return { noJournal : TestData.noJournal }
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
testLog = function(x){
|
testLog = function(x){
|
||||||
print( jsTestFile() + " - " + x )
|
print( jsTestFile() + " - " + x )
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user