aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2018-10-03 11:38:31 +0200
committerDamjan Marion <dmarion@me.com>2018-10-03 17:39:21 +0000
commitd760f79cb8c81eab1dbbd85e1453cad122ecd345 (patch)
treec384d6c847951ba7df95bd7ef02c43a0de5a5088
parent611864f4bddf787aff3323f162da589b1b26529c (diff)
test framework: add shell-style wildcard matching to filenames
Currently, one can either use "*" to denote all filenames, or to give the specific file name to run the tests in. This commit adds the possibility to run all tests matching the shell wildcard, e.g. TEST="test_acl_plugin*" will execute all ACL plugin testcases. Change-Id: I9048a601958947c7b757c3dfd57b19cdd8a1e3c0 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
-rw-r--r--test/run_tests.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/run_tests.py b/test/run_tests.py
index 0cd057ca0c3..6836466373e 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -3,6 +3,7 @@
import sys
import shutil
import os
+import fnmatch
import select
import unittest
import argparse
@@ -425,8 +426,10 @@ class FilterByTestOption:
self.filter_func_name = filter_func_name
def __call__(self, file_name, class_name, func_name):
- if self.filter_file_name and file_name != self.filter_file_name:
- return False
+ if self.filter_file_name:
+ fn_match = fnmatch.fnmatch(file_name, self.filter_file_name)
+ if not fn_match:
+ return False
if self.filter_class_name and class_name != self.filter_class_name:
return False
if self.filter_func_name and func_name != self.filter_func_name: