From 47b6dd223d0e8c98f8b4261302c8c5752e59b8a4 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Thu, 20 Aug 2020 15:38:07 -0700 Subject: Test-runner can filter tests by name (#3067) --- scripts/test/shared.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/test') diff --git a/scripts/test/shared.py b/scripts/test/shared.py index b0cd72d17..2efa44873 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -81,6 +81,10 @@ def parse_args(args): parser.add_argument( '--list-suites', action='store_true', help='List the test suites that can be run.') + parser.add_argument( + '--filter', dest='test_name_filter', default='', + help=('Specifies a filter. Only tests whose paths contains this ' + 'substring will be run')) return parser.parse_args(args) @@ -362,6 +366,8 @@ def get_tests(test_dir, extensions=[]): tests += glob.glob(os.path.join(test_dir, '*')) for ext in extensions: tests += glob.glob(os.path.join(test_dir, '*' + ext)) + if options.test_name_filter: + tests = list(filter(lambda n: n.find(options.test_name_filter) >= 0, tests)) return sorted(tests) -- cgit v1.2.3