Permalink
Browse files

Don't start a mongod when running CppUnittests.

  • Loading branch information...
amschwerin committed Sep 13, 2012
1 parent 3b7bb12 commit e4a55dd9195127c6733d8f7269eea032feafd6ea
Showing with 19 additions and 9 deletions.
  1. +5 −3 SConscript.smoke
  2. +14 −6 buildscripts/smoke.py
View
@@ -53,16 +53,18 @@ def addSmoketest( name, deps, extraSmokeArgs=[] ):
smokeArgs = smokeFlags + [target] + extraSmokeArgs
addTest(name, deps, utils.run_smoke_command(*smokeArgs))
-def addSmokeSuite( name, suitefile ):
+def addSmokeSuite( name, suitefile, needMongod=False ):
# Add a smoketest target which invokes smoke.py with
# --from-file, and passes the named suitefile as the
# command line argument.
# resolve an initial # in the suitefile
suitefile = str(env.File(suitefile))
- addTest(name, [suitefile],
- utils.run_smoke_command('--mode', 'files', '--from-file', suitefile))
+ smoke_args = ['--mode', 'files', '--from-file', suitefile]
+ if not needMongod:
+ smoke_args.append('--dont-start-mongod')
+ addTest(name, [suitefile], utils.run_smoke_command(*smoke_args))
addSmoketest( "smoke", [ add_exe( "test" ), add_exe( "mongod" ), add_exe( "mongo" ) ] )
addSmoketest( "smokePerf", [ add_exe("perftest") ] )
View
@@ -67,6 +67,7 @@
shell_executable = None
continue_on_failure = None
file_of_commands_mode = False
+start_mongod = True
tests = []
winners = []
@@ -450,10 +451,11 @@ def runTest(test):
if r != 0:
raise TestExitFailure(path, r)
- try:
- c = Connection( "127.0.0.1" , int(mongod_port) )
- except Exception,e:
- raise TestServerFailure(path)
+ if start_mongod:
+ try:
+ c = Connection( "127.0.0.1" , int(mongod_port) )
+ except Exception,e:
+ raise TestServerFailure(path)
print ""
@@ -466,7 +468,10 @@ def run_tests(tests):
# The reason we want to use "with" is so that we get __exit__ semantics
# but "with" is only supported on Python 2.5+
- master = mongod(small_oplog_rs=small_oplog_rs,small_oplog=small_oplog,no_journal=no_journal,no_preallocj=no_preallocj,auth=auth).__enter__()
+ if start_mongod:
+ master = mongod(small_oplog_rs=small_oplog_rs,small_oplog=small_oplog,no_journal=no_journal,no_preallocj=no_preallocj,auth=auth).__enter__()
+ else:
+ master = Nothing()
try:
if small_oplog:
slave = mongod(slave=True).__enter__()
@@ -637,8 +642,9 @@ def add_exe(e):
return e
def set_globals(options, tests):
- global mongod_executable, mongod_port, shell_executable, continue_on_failure, small_oplog, small_oplog_rs, no_journal, no_preallocj, auth, keyFile, smoke_db_prefix, test_path
+ global mongod_executable, mongod_port, shell_executable, continue_on_failure, small_oplog, small_oplog_rs, no_journal, no_preallocj, auth, keyFile, smoke_db_prefix, test_path, start_mongod
global file_of_commands_mode
+ start_mongod = options.start_mongod
#Careful, this can be called multiple times
test_path = options.test_path
@@ -798,6 +804,8 @@ def main():
parser.add_option('--with-cleanbb', dest='with_cleanbb', default=False,
action="store_true",
help='Clear database files from previous smoke.py runs')
+ parser.add_option(
+ '--dont-start-mongod', dest='start_mongod', default=True, action='store_false')
# Buildlogger invocation from command line
parser.add_option('--buildlogger-builder', dest='buildlogger_builder', default=None,

0 comments on commit e4a55dd

Please sign in to comment.