From 3c5319e125d8e7938b13502969daec869e5903e4 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 29 May 2024 14:33:01 -0500 Subject: [PATCH] Tweaked test/bench id globbing to avoid duplicating cases Before, globs that match both the suite name and case name would cause end up running the case twice. Which is a bit of a problem, since all cases contain their suite name as a prefix... test_f* => run test_files |-> run test_files_hello |-> run test_files_trunc ... run test_files_hello run test_files_trunc ... Now we only run matching test cases if no suites were found. This has the side-effect of making the universal glob, "*", equivalent to no test ids, which is nice: $ ./scripts/test.py -j -b '*' # equivalent $ ./scripts/test.py -j -b # This is useful for running a specific problematic test first before running the all of the tests: $ ./scripts/test.py -j -b test_files_trunc '*' --- scripts/bench.py | 7 ++++--- scripts/test.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/bench.py b/scripts/bench.py index 41d84ff8..98646300 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -816,9 +816,10 @@ def find_ids(runner, bench_ids=[], **args): bench_ids__.extend(suite for suite in expected_suite_perms.keys() if fnmatch.fnmatch(suite, name)) - bench_ids__.extend(case_ - for case_ in expected_case_perms.keys() - if fnmatch.fnmatch(case_, name)) + if not bench_ids__: + bench_ids__.extend(case_ + for case_ in expected_case_perms.keys() + if fnmatch.fnmatch(case_, name)) # literal suite elif name in expected_suite_perms: bench_ids__.append(id) diff --git a/scripts/test.py b/scripts/test.py index 73473428..e7bfc9d1 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -833,9 +833,10 @@ def find_ids(runner, test_ids=[], **args): test_ids__.extend(suite for suite in expected_suite_perms.keys() if fnmatch.fnmatch(suite, name)) - test_ids__.extend(case_ - for case_ in expected_case_perms.keys() - if fnmatch.fnmatch(case_, name)) + if not test_ids__: + test_ids__.extend(case_ + for case_ in expected_case_perms.keys() + if fnmatch.fnmatch(case_, name)) # literal suite elif name in expected_suite_perms: test_ids__.append(id)