diff options
author | Mike Grundy <michael.grundy@10gen.com> | 2016-07-11 09:50:21 -0400 |
---|---|---|
committer | Mike Grundy <michael.grundy@10gen.com> | 2016-07-13 14:51:02 -0400 |
commit | e572d00484bafd5689c18010388675afa9e26f96 (patch) | |
tree | aed3bab1c6866b0934918e188a6820c6b0662ee7 /buildscripts/burn_in_tests.py | |
parent | a53d25936a00cce75d7332a4b7e513814773eaf6 (diff) | |
download | mongo-e572d00484bafd5689c18010388675afa9e26f96.tar.gz |
SERVER-24636 Add option to burn_in_tests to specify githash to compare to
Diffstat (limited to 'buildscripts/burn_in_tests.py')
-rw-r--r-- | buildscripts/burn_in_tests.py | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/buildscripts/burn_in_tests.py b/buildscripts/burn_in_tests.py index 6cb84c0abd5..376a611a9e2 100644 --- a/buildscripts/burn_in_tests.py +++ b/buildscripts/burn_in_tests.py @@ -20,7 +20,16 @@ if __name__ == "__main__" and __package__ is None: def parse_command_line(): - parser = optparse.OptionParser() + parser = optparse.OptionParser(usage="Usage: %prog [options] [resmoke command]") + + parser.add_option("--maxRevisions", dest="max_revisions", + help="Maximum number of revisions to check for changes. Default is 25.") + + parser.add_option("--branch", dest="branch", + help="The name of the branch the working branch was based on.") + + parser.add_option("--baseCommit", dest="base_commit", + help="The base commit to compare to for determining changes.") parser.add_option("--noExec", dest="no_exec", action="store_true", help="Do not run resmoke loop on new tests.") @@ -28,9 +37,6 @@ def parse_command_line(): parser.add_option("--reportFile", dest="report_file", help="Write a JSON file with test executor information.") - parser.add_option("--resmokeCmd", dest="resmoke_cmd", - help="Arguments to pass through to resmoke.py") - parser.add_option("--skipEnterpriseSuites", dest="no_enterprise", action="store_true", help="Do not run against enterprise specific executors.") @@ -39,7 +45,10 @@ def parse_command_line(): # The executor_file and suite_files defaults are required to make the # suite resolver work correctly. - parser.set_defaults(executor_file="with_server", + parser.set_defaults(base_commit=None, + branch="master", + executor_file="with_server", + max_revisions=25, no_exec=False, no_enterprise=False, suite_files=None) @@ -108,15 +117,25 @@ def callo(args): return check_output(args) -def find_changed_tests(): +def find_changed_tests(branch_name, base_commit, max_revisions): """ Use git to find which files have changed in this patch. TODO: This should be expanded to search for enterprise modules. - TODO: We should be able to specify a revision or parse like evergreen patch does. """ changed_tests = [] - changed_files = callo(["git", "diff", "--name-only", "HEAD"]) + if base_commit is None: + base_commit = callo(["git", "merge-base", branch_name + "@{upstream}", "HEAD"]).rstrip() + revision_count = int(callo(["git", "rev-list", "--count", base_commit + "...HEAD"])) + + if revision_count > max_revisions: + print ("There are too many revisions included. This is likely " + "because your base branch is not " + branch_name + ". " + "You can allow us to review more than 25 revisions by using the " + "--maxRevisions option.") + return changed_tests + + changed_files = callo(["git", "diff", "--name-only", base_commit]) for line in changed_files.splitlines(): line = line.rstrip() # Check that the file exists because it may have been moved or deleted in the patch. @@ -209,7 +228,7 @@ def main(): # Run the executor finder. else: - changed_tests = find_changed_tests() + changed_tests = find_changed_tests(values.branch, values.base_commit, values.max_revisions) # If there are no changed tests, exit cleanly. if not changed_tests: print "No new or modified tests found." @@ -234,9 +253,9 @@ def main(): tests_by_executor.pop(executor) print "Skipping executor", executor elif not os.path.isfile(ekf2_file): - print "The mongo enterprise module is not installed." - print "You may specify the --skipEnterpriseSuites flag to skip these" - print "test executors, or run against an enterprise build." + print ("The mongo enterprise module is not installed. " + "You may specify the --skipEnterpriseSuites flag to skip these " + "test executors, or run against an enterprise build.") sys.exit(1) else: # We have the files to run enterprise executors. |