summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kangas <matt.kangas@mongodb.com>2014-05-02 17:41:49 -0400
committerMatt Kangas <matt.kangas@mongodb.com>2014-05-08 09:05:19 -0400
commitb267b2824ea6043cd27c14cfef6ff8af6f93b861 (patch)
tree8f085927a733a97bd5e529f768395a6df2abe40c
parent71e4c210ec024b8260d6bdee1bfe8dc21ab8c696 (diff)
downloadmongo-b267b2824ea6043cd27c14cfef6ff8af6f93b861.tar.gz
SERVER-13712 smoke.py --clean-every=N option
(cherry picked from commit 8cd645a8fa0cce6313c4a15e4f3ec4fd8ac2787e)
-rwxr-xr-xbuildscripts/smoke.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py
index 0d047f74d6c..9adda8ee52a 100755
--- a/buildscripts/smoke.py
+++ b/buildscripts/smoke.py
@@ -45,10 +45,7 @@ import shutil
import shlex
import socket
import stat
-from subprocess import (Popen,
- PIPE,
- STDOUT,
- call)
+from subprocess import (call, PIPE, Popen, STDOUT)
import sys
import time
@@ -87,6 +84,7 @@ continue_on_failure = None
file_of_commands_mode = False
start_mongod = True
temp_path = None
+clean_every_n_tests = 1
tests = []
winners = []
@@ -672,8 +670,7 @@ def run_tests(tests):
if small_oplog or small_oplog_rs:
master.wait_for_repl()
- tests_run = 0
- for tests_run, test in enumerate(tests):
+ for tests_run, test in enumerate(tests, 1):
test_result = { "start": time.time() }
(test_path, use_db) = test
@@ -708,8 +705,8 @@ def run_tests(tests):
check_and_report_replication_dbhashes()
elif use_db: # reach inside test and see if "usedb" is true
- if (tests_run+1) % 20 == 0:
- # restart mongo every 20 times, for our 32-bit machines
+ if (tests_run % clean_every_n_tests) == 0:
+ # restart mongo every 'clean_every_n_tests' times
master.__exit__(None, None, None)
master = mongod(small_oplog_rs=small_oplog_rs,
small_oplog=small_oplog,
@@ -983,6 +980,8 @@ def set_globals(options, tests):
global file_of_commands_mode
global report_file, shell_write_mode, use_write_commands
global temp_path
+ global clean_every_n_tests
+
start_mongod = options.start_mongod
if hasattr(options, 'use_ssl'):
use_ssl = options.use_ssl
@@ -1014,6 +1013,7 @@ def set_globals(options, tests):
auth = options.auth
authMechanism = options.authMechanism
keyFile = options.keyFile
+ clean_every_n_tests = options.clean_every_n_tests
if auth and not keyFile:
# if only --auth was given to smoke.py, load the
@@ -1174,9 +1174,12 @@ def main():
parser.add_option('--reset-old-fails', dest='reset_old_fails', default=False,
action="store_true",
help='Clear the failfile. Do this if all tests pass')
- 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('--with-cleanbb', dest='with_cleanbb', action="store_true",
+ default=False,
+ help='Clear database files before first test')
+ parser.add_option('--clean-every', dest='clean_every_n_tests', type='int',
+ default=20,
+ help='Clear database files every N tests [default %default]')
parser.add_option('--dont-start-mongod', dest='start_mongod', default=True,
action='store_false',
help='Do not start mongod before commencing test running')