From 13b77b3e4173a24ae8ad5dac53d7ae675daf8395 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Mon, 4 Sep 2023 15:46:07 -0700 Subject: [PATCH] ext,tests: Allow passing of `--uid` to `./main.py list` This is useful for listing the fixtures of a Suite. Change-Id: Id2f1294cc7dea03a6b26e8abc5083886fe0299d9 --- ext/testlib/configuration.py | 7 +++++++ ext/testlib/main.py | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ext/testlib/configuration.py b/ext/testlib/configuration.py index 600f0e13cc..918a3f92b3 100644 --- a/ext/testlib/configuration.py +++ b/ext/testlib/configuration.py @@ -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) diff --git a/ext/testlib/main.py b/ext/testlib/main.py index 59ce050bfd..e9dd892947 100644 --- a/ext/testlib/main.py +++ b/ext/testlib/main.py @@ -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)