From d760f79cb8c81eab1dbbd85e1453cad122ecd345 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Wed, 3 Oct 2018 11:38:31 +0200 Subject: 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 --- test/run_tests.py | 7 +++++-- 1 file 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: -- cgit 1.2.3-korg