diff options
author | Mike Dirolf <mike@10gen.com> | 2010-08-30 13:11:21 -0400 |
---|---|---|
committer | Mike Dirolf <mike@10gen.com> | 2010-08-30 13:11:28 -0400 |
commit | e82816917dbccc3d4a99ecaa62f19eb50c8c6e59 (patch) | |
tree | 54b714c669291f2046e100cf96a13d9631e5987c /buildscripts | |
parent | 2136d1e970a2540463643d524b19b4d2f85be95f (diff) | |
download | mongo-e82816917dbccc3d4a99ecaa62f19eb50c8c6e59.tar.gz |
clean up smoke.py options handling
Diffstat (limited to 'buildscripts')
-rwxr-xr-x | buildscripts/smoke.py | 68 |
1 files changed, 25 insertions, 43 deletions
diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py index 1b7a1f45fc9..27ee8649b37 100755 --- a/buildscripts/smoke.py +++ b/buildscripts/smoke.py @@ -51,14 +51,14 @@ import time import utils +# TODO clean this up so we don't need globals... mongo_repo = os.getcwd() #'./' test_path = None - -mongod_executable = "./mongod" -mongod_port = "32000" -shell_executable = "./mongo" -continue_on_failure = False -one_mongod_per_test = False +mongod_executable = None +mongod_port = None +shell_executable = None +continue_on_failure = None +one_mongod_per_test = None tests = [] winners = [] @@ -353,7 +353,7 @@ at the end of testing:""" def expand_suites(suites): globstr = None - global mongo_repo, tests + global tests for suite in suites: if suite == 'all': tests = [] @@ -413,20 +413,19 @@ def expand_suites(suites): def main(): parser = OptionParser(usage="usage: smoke.py [OPTIONS] ARGS*") parser.add_option('--mode', dest='mode', default='suite', - help='If "files", ARGS are filenames; if "suite", ARGS are sets of tests. (default "suite")') + help='If "files", ARGS are filenames; if "suite", ARGS are sets of tests (%default)') # Some of our tests hard-code pathnames e.g., to execute, so until - # th we don't have the freedom to run from anyplace. -# parser.add_option('--mongo-repo', dest='mongo_repo', default=None, -# help='Top-level directory of mongo checkout to use. (default: script will make a guess)') + # that changes we don't have the freedom to run from anyplace. + # parser.add_option('--mongo-repo', dest='mongo_repo', default=None, parser.add_option('--test-path', dest='test_path', default=None, - help="Path to the test executables to run " - "(currently only used for 'client')") - parser.add_option('--mongod', dest='mongod_executable', #default='./mongod', - help='Path to mongod to run (default "./mongod")') + help="Path to the test executables to run, " + "currently only used for 'client' (%default)") + parser.add_option('--mongod', dest='mongod_executable', default=os.path.join(mongo_repo, 'mongod'), + help='Path to mongod to run (%default)') parser.add_option('--port', dest='mongod_port', default="32000", - help='Port the mongod will bind to (default 32000)') - parser.add_option('--mongo', dest='shell_executable', #default="./mongo", - help='Path to mongo, for .js test files (default "./mongo")') + help='Port the mongod will bind to (%default)') + parser.add_option('--mongo', dest='shell_executable', default=os.path.join(mongo_repo, 'mongo'), + help='Path to mongo, for .js test files (%default)') parser.add_option('--continue-on-failure', dest='continue_on_failure', action="store_true", default=False, help='If supplied, continue testing even after a test fails') @@ -435,40 +434,23 @@ def main(): help='If supplied, run each test in a fresh mongod') parser.add_option('--from-file', dest='File', help="Run tests/suites named in FILE, one test per line, '-' means stdin") - parser.add_option('--smoke-db-prefix', dest='smoke_db_prefix', default='', - help="Prefix to use for the mongods' dbpaths.") + parser.add_option('--smoke-db-prefix', dest='smoke_db_prefix', default=smoke_db_prefix, + help="Prefix to use for the mongods' dbpaths ('%default')") parser.add_option('--small-oplog', dest='small_oplog', default=False, action="store_true", help='Run tests with master/slave replication & use a small oplog') global tests (options, tests) = parser.parse_args() -# global mongo_repo -# if options.mongo_repo: -# pass -# mongo_repo = options.mongo_repo -# else: -# prefix = '' -# while True: -# if os.path.exists(prefix+'buildscripts'): -# mongo_repo = os.path.normpath(prefix) -# break -# else: -# prefix += '../' -# # FIXME: will this be a device's root directory on -# # Windows? -# if os.path.samefile('/', prefix): -# raise Exception("couldn't guess the mongo repository path") - print tests - global mongo_repo, mongod_executable, mongod_port, shell_executable, continue_on_failure, one_mongod_per_test, small_oplog, smoke_db_prefix, test_path + global mongod_executable, mongod_port, shell_executable, continue_on_failure, one_mongod_per_test, small_oplog, smoke_db_prefix, test_path test_path = options.test_path - mongod_executable = options.mongod_executable if options.mongod_executable else os.path.join(mongo_repo, 'mongod') - mongod_port = options.mongod_port if options.mongod_port else mongod_port - shell_executable = options.shell_executable if options.shell_executable else os.path.join(mongo_repo, 'mongo') - continue_on_failure = options.continue_on_failure if options.continue_on_failure else continue_on_failure - one_mongod_per_test = options.one_mongod_per_test if options.one_mongod_per_test else one_mongod_per_test + mongod_executable = options.mongod_executable + mongod_port = options.mongod_port + shell_executable = options.shell_executable + continue_on_failure = options.continue_on_failure + one_mongod_per_test = options.one_mongod_per_test smoke_db_prefix = options.smoke_db_prefix small_oplog = options.small_oplog |