summaryrefslogtreecommitdiff
path: root/buildscripts/resmokelib/configure_resmoke.py
diff options
context:
space:
mode:
authorTrevor Guidry <trevor.guidry@mongodb.com>2022-11-16 17:24:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-16 23:38:40 +0000
commit5171d72f3a20559f7433d4a6a7283de189cb81a2 (patch)
treeeaca611055481107d9dc3693ad2c0f81378c1bed /buildscripts/resmokelib/configure_resmoke.py
parentdf396f724005fb7011f1b42cb727501a4cfda975 (diff)
downloadmongo-5171d72f3a20559f7433d4a6a7283de189cb81a2.tar.gz
SERVER-63104 add resmoke argument for generating all_feature_flags.txt locally
(cherry picked from commit 22f38cf147eeedca45943ababe818213184eb754)
Diffstat (limited to 'buildscripts/resmokelib/configure_resmoke.py')
-rw-r--r--buildscripts/resmokelib/configure_resmoke.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/buildscripts/resmokelib/configure_resmoke.py b/buildscripts/resmokelib/configure_resmoke.py
index af8a0fb09fe..aa5a384f17d 100644
--- a/buildscripts/resmokelib/configure_resmoke.py
+++ b/buildscripts/resmokelib/configure_resmoke.py
@@ -15,6 +15,7 @@ import shlex
import pymongo.uri_parser
+from buildscripts.idl import gen_all_feature_flag_list
from buildscripts.idl.lib import ALL_FEATURE_FLAG_FILE
from buildscripts.resmokelib import config as _config
@@ -52,14 +53,9 @@ def _validate_options(parser, args):
"Cannot use --replayFile with additional test files listed on the command line invocation."
)
- if args.run_all_feature_flag_tests or args.run_all_feature_flags_no_tests:
- if not os.path.isfile(ALL_FEATURE_FLAG_FILE):
- parser.error(
- "To run tests with all feature flags, the %s file must exist and be placed in"
- " your working directory. The file can be downloaded from the artifacts tarball"
- " in Evergreen. Alternatively, if you know which feature flags you want to enable,"
- " you can use the --additionalFeatureFlags command line argument" %
- ALL_FEATURE_FLAG_FILE)
+ if args.additional_feature_flags_file and not os.path.isfile(
+ args.additional_feature_flags_file):
+ parser.error("The specified additional feature flags file does not exist.")
def get_set_param_errors(process_params):
agg_set_params = collections.defaultdict(list)
@@ -185,28 +181,36 @@ be invoked as either:
- buildscripts/resmoke.py --installDir {shlex.quote(user_config['install_dir'])}""")
raise RuntimeError(err)
+ def process_feature_flag_file(path):
+ with open(path) as fd:
+ return fd.read().split()
+
def setup_feature_flags():
_config.RUN_ALL_FEATURE_FLAG_TESTS = config.pop("run_all_feature_flag_tests")
- _config.RUN_ALL_FEATURE_FLAGS = config.pop("run_all_feature_flags_no_tests")
+ _config.RUN_NO_FEATURE_FLAG_TESTS = config.pop("run_no_feature_flag_tests")
+ _config.ADDITIONAL_FEATURE_FLAGS_FILE = config.pop("additional_feature_flags_file")
- # Running all feature flag tests implies running the fixtures with feature flags.
if _config.RUN_ALL_FEATURE_FLAG_TESTS:
- _config.RUN_ALL_FEATURE_FLAGS = True
+ print("Generating: ", ALL_FEATURE_FLAG_FILE)
+ gen_all_feature_flag_list.gen_all_feature_flags_file()
all_ff = []
enabled_feature_flags = []
try:
- with open(ALL_FEATURE_FLAG_FILE) as fd:
- all_ff = fd.read().split()
+ all_ff = process_feature_flag_file(ALL_FEATURE_FLAG_FILE)
except FileNotFoundError:
# If we ask resmoke to run with all feature flags, the feature flags file
# needs to exist.
- if _config.RUN_ALL_FEATURE_FLAGS:
+ if _config.RUN_ALL_FEATURE_FLAG_TESTS or _config.RUN_NO_FEATURE_FLAG_TESTS:
raise
- if _config.RUN_ALL_FEATURE_FLAGS:
+ if _config.RUN_ALL_FEATURE_FLAG_TESTS:
enabled_feature_flags = all_ff[:]
+ if _config.ADDITIONAL_FEATURE_FLAGS_FILE:
+ enabled_feature_flags.extend(
+ process_feature_flag_file(_config.ADDITIONAL_FEATURE_FLAGS_FILE))
+
# Specify additional feature flags from the command line.
# Set running all feature flag tests to True if this options is specified.
additional_feature_flags = _tags_from_list(config.pop("additional_feature_flags"))
@@ -231,7 +235,7 @@ be invoked as either:
_config.EXCLUDE_WITH_ANY_TAGS.extend(
utils.default_if_none(_tags_from_list(config.pop("exclude_with_any_tags")), []))
- if _config.RUN_ALL_FEATURE_FLAGS and not _config.RUN_ALL_FEATURE_FLAG_TESTS:
+ if _config.RUN_NO_FEATURE_FLAG_TESTS:
# Don't run any feature flag tests.
_config.EXCLUDE_WITH_ANY_TAGS.extend(all_feature_flags)
else: