Add command line switches for testpaths and logpath
This provides another option for the automation automator
to more flexibly automate the automation.
Bug: 31122931
Change-Id: Ifd47381e7d29eb05a72fa71128a277b668274419
(cherry picked from commit b28f1c41232c25e613403e812f657030f9d3d017)
diff --git a/acts/framework/acts/bin/act.py b/acts/framework/acts/bin/act.py
index 8fa87d2..a5381c7 100755
--- a/acts/framework/acts/bin/act.py
+++ b/acts/framework/acts/bin/act.py
@@ -139,7 +139,7 @@
result.append(_parse_one_test_specifier(elem))
return result
-def load_test_config_file(test_config_path, tb_filters=None):
+def load_test_config_file(test_config_path, tb_filters, test_paths, log_path):
"""Processes the test configuration file provied by user.
Loads the configuration file into a json object, unpacks each testbed
@@ -148,12 +148,22 @@
Args:
test_config_path: Path to the test configuration file.
+ tb_filters: A subset of test bed names to be pulled from the
+ config file. If None, then all test beds will be selected.
+ test_paths: A list of command-line default for the test path.
+ If None, then the paths must be specified within the config file.
+ log_path: A command-line default for the log path. If None, then the
+ log path must be specified in the config file.
Returns:
A list of test configuration json objects to be passed to TestRunner.
"""
try:
configs = load_config(test_config_path)
+ if test_paths:
+ configs[Config.key_test_paths.value] = test_paths
+ if log_path:
+ configs[Config.key_log_path.value] = log_path
if tb_filters:
tbs = []
for tb in configs[Config.key_testbed.value]:
@@ -272,6 +282,20 @@
parser.add_argument('-tb', '--testbed', nargs='+', type=str,
metavar="[<TEST BED NAME1> <TEST BED NAME2> ...]",
help="Specify which test beds to run tests on.")
+ parser.add_argument(
+ '-lp',
+ '--logpath',
+ type=str,
+ metavar="<PATH>",
+ help=("Root path under which all logs will be placed."))
+ parser.add_argument(
+ '-tp',
+ '--testpaths',
+ nargs='*',
+ type=str,
+ metavar="<PATH> <PATH>",
+ help=("One or more non-recursive test class search paths."))
+
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-tc', '--testclass', nargs='+', type=str,
metavar="[TestClass1 TestClass2:test_xxx ...]",
@@ -290,7 +314,8 @@
test_list = args.testclass
if args.repeat:
repeat = args.repeat
- parsed_configs = load_test_config_file(args.config[0], args.testbed)
+ parsed_configs = load_test_config_file(args.config[0], args.testbed,
+ args.testpaths, args.logpath)
if not parsed_configs:
print("Encountered error when parsing the config file, abort!")
sys.exit(1)