summaryrefslogtreecommitdiffstats
path: root/extras/autowaf.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-04-14 15:03:41 +0200
committerDavid Robillard <d@drobilla.net>2019-04-14 15:07:02 +0200
commit27a69a76d1f625ad86b60b5dbd12368bc25cae25 (patch)
treea37a98d8597a4525047e7910488e495dfdc8072a /extras/autowaf.py
parentac29b74acc4c6daf41c3e4786221fb2906b320b6 (diff)
downloadautowaf-27a69a76d1f625ad86b60b5dbd12368bc25cae25.tar.gz
autowaf-27a69a76d1f625ad86b60b5dbd12368bc25cae25.tar.bz2
autowaf-27a69a76d1f625ad86b60b5dbd12368bc25cae25.zip
Add option to filter tests by regular expression
Diffstat (limited to 'extras/autowaf.py')
-rw-r--r--extras/autowaf.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/extras/autowaf.py b/extras/autowaf.py
index 08f37c0..5feef03 100644
--- a/extras/autowaf.py
+++ b/extras/autowaf.py
@@ -93,6 +93,9 @@ def set_options(opt, debug_by_default=False):
test_opts.add_option('--wrapper', type='string',
dest='test_wrapper',
help='command prefix for tests (e.g. valgrind)')
+ test_opts.add_option('--test-filter', type='string',
+ dest='test_filter',
+ help='regular expression for tests to run')
# Run options
run_opts = opt.add_option_group('Run options')
@@ -866,12 +869,26 @@ class TestScope:
self.n_total = 0
def run(self, test, **kwargs):
+ if type(test) == list and 'name' not in kwargs:
+ import pipes
+ kwargs['name'] = ' '.join(map(pipes.quote, test))
+
+ if Options.options.test_filter and 'name' in kwargs:
+ import re
+ found = False
+ for scope in self.tst.stack:
+ if re.search(Options.options.test_filter, scope.name):
+ found = True
+ break
+
+ if (not found and
+ not re.search(Options.options.test_filter, self.name) and
+ not re.search(Options.options.test_filter, kwargs['name'])):
+ return True
+
if callable(test):
output = self._run_callable(test, **kwargs)
elif type(test) == list:
- if 'name' not in kwargs:
- import pipes
- kwargs['name'] = ' '.join(map(pipes.quote, test))
output = self._run_command(test, **kwargs)
else: