diff options
author | Matt Kangas <matt.kangas@mongodb.com> | 2014-05-02 17:41:49 -0400 |
---|---|---|
committer | Matt Kangas <matt.kangas@mongodb.com> | 2014-05-07 22:19:57 -0400 |
commit | 8cd645a8fa0cce6313c4a15e4f3ec4fd8ac2787e (patch) | |
tree | 8d9a863eb84ecde4b9bb8290e5ccaa5669bd7cf5 /buildscripts/smoke.py | |
parent | d900470dc3fbe19539a8404b5216974b9688f90e (diff) | |
download | mongo-8cd645a8fa0cce6313c4a15e4f3ec4fd8ac2787e.tar.gz |
SERVER-13712 smoke.py --clean-every=N option
Diffstat (limited to 'buildscripts/smoke.py')
-rwxr-xr-x | buildscripts/smoke.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py index cb9bf52f5d3..c12cdbf66fd 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 = [] @@ -674,8 +672,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 @@ -710,8 +707,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, @@ -985,6 +982,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 @@ -1016,6 +1015,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 @@ -1176,9 +1176,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') |