From a9c0e32162795fe343624d896dad2b040b202723 Mon Sep 17 00:00:00 2001 From: Brian Ok <63064763+okBrian@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:24:30 -0700 Subject: [PATCH] Improve Only Flag for Test (#518) --- toolchain/mfc/args.py | 2 +- toolchain/mfc/test/test.py | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/toolchain/mfc/args.py b/toolchain/mfc/args.py index ca982d286..6ad9cf399 100644 --- a/toolchain/mfc/args.py +++ b/toolchain/mfc/args.py @@ -80,7 +80,7 @@ def add_common_arguments(p, mask = None): test.add_argument("-l", "--list", action="store_true", help="List all available tests.") test.add_argument("-f", "--from", default=test_cases[0].get_uuid(), type=str, help="First test UUID to run.") test.add_argument("-t", "--to", default=test_cases[-1].get_uuid(), type=str, help="Last test UUID to run.") - test.add_argument("-o", "--only", nargs="+", type=str, default=[], metavar="L", help="Only run tests with UUIDs or hashes L.") + test.add_argument("-o", "--only", nargs="+", type=str, default=[], metavar="L", help="Only run tests with specified properties.") test.add_argument("-r", "--relentless", action="store_true", default=False, help="Run all tests, even if multiple fail.") test.add_argument("-a", "--test-all", action="store_true", default=False, help="Run the Post Process Tests too.") test.add_argument("-%", "--percent", type=int, default=100, help="Percentage of tests to run.") diff --git a/toolchain/mfc/test/test.py b/toolchain/mfc/test/test.py index 825c4689b..83b163fdd 100644 --- a/toolchain/mfc/test/test.py +++ b/toolchain/mfc/test/test.py @@ -39,18 +39,15 @@ def __filter(cases_) -> typing.List[TestCase]: raise MFCException("Testing: Your specified range [--from,--to] is incorrect. Please ensure both IDs exist and are in the correct order.") if len(ARG("only")) > 0: - for i, case in enumerate(cases[:]): + for case in cases[:]: case: TestCase - doKeep = False - for o in ARG("only"): - if str(o) == case.get_uuid(): - doKeep = True - break - - if not doKeep: + checkCase = case.trace.split(" -> ") + checkCase.append(case.get_uuid()) + if not set(ARG("only")).issubset(set(checkCase)): cases.remove(case) + for case in cases[:]: if case.ppn > 1 and not ARG("mpi"): cases.remove(case)