ext,tests: Allow passing of --uid to ./main.py list

This is useful for listing the fixtures of a Suite.

Change-Id: Id2f1294cc7dea03a6b26e8abc5083886fe0299d9
This commit is contained in:
Bobby R. Bruce
2023-09-04 15:46:07 -07:00
parent 43226004a1
commit 13b77b3e41
2 changed files with 26 additions and 1 deletions

View File

@@ -751,6 +751,13 @@ class ListParser(ArgParser):
default=False,
help="Quiet output (machine readable).",
).add_to(parser)
Argument(
'--uid',
action='store',
default=None,
help='UID of a specific test item to list.'
).add_to(parser)
common_args.directories.add_to(parser)
common_args.bin_path.add_to(parser)

View File

@@ -242,7 +242,25 @@ def do_list():
entry_message()
test_schedule = load_tests().schedule
if configuration.config.uid:
uid_ = uid.UID.from_uid(configuration.config.uid)
if isinstance(uid_, uid.TestUID):
log.test_log.error('Unable to list a standalone test.\n'
'Gem5 expects test suites to be the smallest unit '
' of test.\n\n'
'Pass a SuiteUID instead.')
return
test_schedule = loader_mod.Loader().load_schedule_for_suites(uid_)
if get_config_tags():
log.test_log.warn(
"The '--uid' flag was supplied,"
" '--include-tags' and '--exclude-tags' will be ignored."
)
else:
test_schedule = load_tests().schedule
# Filter tests based on tags
filter_with_config_tags(test_schedule)
filter_with_config_tags(test_schedule)
qrunner = query.QueryRunner(test_schedule)