[autotest] Extract _parse_control_file_texts
BUG=chromium:672348
TEST=None
Change-Id: Id1ff9e87fbb678b4827825d7744bbeae9485e958
Reviewed-on: https://chromium-review.googlesource.com/447793
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/server/cros/dynamic_suite/suite.py b/server/cros/dynamic_suite/suite.py
index 5c8687c..2738145 100644
--- a/server/cros/dynamic_suite/suite.py
+++ b/server/cros/dynamic_suite/suite.py
@@ -345,7 +345,6 @@
parameters.
"""
logging.debug('Getting control file list for suite: %s', suite_name)
- tests = {}
if _should_batch_with(cf_getter):
suite_info = cf_getter.get_suite_info(suite_name=suite_name)
files = suite_info.keys()
@@ -362,6 +361,36 @@
else:
control_file_texts = _get_control_file_texts(
cf_getter, filtered_files)
+ return _parse_control_file_texts(
+ control_file_texts=control_file_texts,
+ add_experimental=add_experimental,
+ forgiving_parser=forgiving_parser,
+ run_prod_code=run_prod_code,
+ test_args=test_args)
+
+
+def _parse_control_file_texts(control_file_texts, add_experimental=False,
+ forgiving_parser=True, run_prod_code=False,
+ test_args=None):
+ """Parse control file texts.
+
+ @param control_file_texts: iterable of (path, text) pairs
+ @param add_experimental: add tests with experimental attribute set.
+ @param forgiving_parser: If False, will raise ControlVariableExceptions
+ if any are encountered when parsing control
+ files. Note that this can raise an exception
+ for syntax errors in unrelated files, because
+ we parse them before applying the predicate.
+ @param run_prod_code: If true, the suite will run the test code that
+ lives in prod aka the test code currently on the
+ lab servers by disabling SSP for the discovered
+ tests.
+ @param test_args: A dict of args to be seeded in test control file under
+ the name |args_dict|.
+
+ @returns: a dictionary of ControlData objects
+ """
+ tests = {}
for file, text in control_file_texts:
# Seed test_args into the control file.
if test_args: