aboutsummaryrefslogtreecommitdiffstats
path: root/test/run_tests.py
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2025-03-19 14:11:44 +0000
committerDave Wallace <dwallacelf@gmail.com>2025-03-20 14:51:26 +0000
commite1705791e6fa7d80d14110cabbc6979d497e9e12 (patch)
tree4c63d746a2d27eb0716e42f99c2eee48f95e6a76 /test/run_tests.py
parent66b33413ca2c27864edf36ba5ea66cad9fbf900d (diff)
tests: allow to define SKIP_TESTS in a similar fashion to TESTHEADmaster
This change adds the possibility to specify the tests to skip from the selected set of tests. This allows to construct test sets "everything except foo and bar" that are tedious to make otherwise. Type: improvement Change-Id: I0862031baf22fef926554873a88a068dfc8f0623 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'test/run_tests.py')
-rw-r--r--test/run_tests.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/run_tests.py b/test/run_tests.py
index 66e0ee4db39..166f5d3cd48 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -685,8 +685,9 @@ def filter_tests(tests, filter_cb):
class FilterByTestOption:
- def __init__(self, filters):
+ def __init__(self, filters, skip_filters):
self.filters = filters
+ self.skip_filters = skip_filters
def __call__(self, file_name, class_name, func_name):
def test_one(
@@ -716,6 +717,21 @@ class FilterByTestOption:
class_name,
func_name,
):
+ for (
+ x_filter_file_name,
+ x_filter_class_name,
+ x_filter_func_name,
+ ) in self.skip_filters:
+ if test_one(
+ x_filter_file_name,
+ x_filter_class_name,
+ x_filter_func_name,
+ file_name,
+ class_name,
+ func_name,
+ ):
+ # If the test matches the excluded tests, do not run it
+ return False
return True
return False
@@ -976,6 +992,11 @@ if __name__ == "__main__":
print("Running tests using custom test runner.")
filters = [(parse_test_filter(f)) for f in config.filter.split(",")]
+ skip_filters = [(parse_test_filter(f)) for f in config.skip_filter.split(",")]
+ # Remove the (None, None, None) triplet that gets pushed by default
+ skip_filters = [
+ triplet for triplet in skip_filters if triplet != (None, None, None)
+ ]
print(
"Selected filters: ",
@@ -984,8 +1005,15 @@ if __name__ == "__main__":
for filter_file, filter_class, filter_func in filters
),
)
+ print(
+ "Selected skip filters: ",
+ "|".join(
+ f"file={filter_file}, class={filter_class}, function={filter_func}"
+ for filter_file, filter_class, filter_func in skip_filters
+ ),
+ )
- filter_cb = FilterByTestOption(filters)
+ filter_cb = FilterByTestOption(filters, skip_filters)
cb = SplitToSuitesCallback(filter_cb)
for d in config.test_src_dir: