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>
This commit is contained in:

committed by
Damjan Marion

parent
611864f4bd
commit
d760f79cb8
@ -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:
|
||||
|
Reference in New Issue
Block a user