Commit dbe762aa authored by Stephen Martinis's avatar Stephen Martinis Committed by Commit Bot

mini_installer: Add --test-list argument

This is the standard way isolated scripts allow for callers to specify a
subset of tests to run. This CL adds this argument, and integrates it
with the existing method for specifying a subset of tests to run.

Bug: 533481
Change-Id: Ib63c18cfa5cb3db8a5256b7969dccb9541d4f9cc
Reviewed-on: https://chromium-review.googlesource.com/1112767
Commit-Queue: Stephen Martinis <martiniss@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570182}
parent 2b8b1806
......@@ -60,6 +60,10 @@ def GetArgumentParser(doc=__doc__):
help='Force cleaning existing installations')
parser.add_argument('--write-full-results-to', metavar='FILENAME',
help='Path to write the list of full results to.')
# Here to satisfy the isolated script test interface. See
# //testing/scripts/run_isolated_script_test.py
parser.add_argument('--test-list', metavar='FILENAME',
help='File path containing the list of tests to run.')
parser.add_argument('test', nargs='*',
help='Name(s) of tests to run.')
......@@ -499,7 +503,16 @@ def GetAbsoluteConfigPath(path):
def DoMain():
args = GetArgumentParser().parse_args()
parser = GetArgumentParser()
args = parser.parse_args()
tests_to_run = args.test
if args.test_list:
if tests_to_run:
parser.error('cannot specify both --test-list and |test|')
with open(args.test_list) as f:
tests_to_run = [test.strip() for test in f.readlines()]
# Due to what looks like a bug the root handlers need to be cleared out
# so the right handler will be created.
......@@ -540,7 +553,7 @@ def DoMain():
test_name = '%s.%s.%s' % (InstallerTest.__module__,
InstallerTest.__name__,
test['name'])
if not args.test or test_name in args.test:
if not tests_to_run or test_name in tests_to_run:
suite.addTest(InstallerTest(test['name'], test['traversal'], config,
variable_expander))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment