THRIFT-3611 Add --regex filter to cross test runner
Client: Test
Patch: Nobuaki Sukegawa
This closes #843
diff --git a/test/crossrunner/collect.py b/test/crossrunner/collect.py
index e91ac0b..d7594cb 100644
--- a/test/crossrunner/collect.py
+++ b/test/crossrunner/collect.py
@@ -22,6 +22,7 @@
from itertools import product
from .util import merge_dict
+from .test import TestEntry
# Those keys are passed to execution as is.
# Note that there are keys other than these, namely:
@@ -144,12 +145,18 @@
}
-def collect_cross_tests(tests_dict, server_match, client_match):
+def _filter_entries(tests, regex):
+ if regex:
+ return filter(lambda t: re.search(regex, TestEntry.get_name(**t)), tests)
+ return tests
+
+
+def collect_cross_tests(tests_dict, server_match, client_match, regex):
sv, cl = _collect_testlibs(tests_dict, server_match, client_match)
- return list(_do_collect_tests(sv, cl))
+ return list(_filter_entries(_do_collect_tests(sv, cl), regex))
-def collect_feature_tests(tests_dict, features_dict, server_match, feature_match):
+def collect_feature_tests(tests_dict, features_dict, server_match, feature_match, regex):
sv, _ = _collect_testlibs(tests_dict, server_match)
ft = collect_features(features_dict, feature_match)
- return list(_do_collect_tests(sv, ft))
+ return list(_filter_entries(_do_collect_tests(sv, ft), regex))
diff --git a/test/crossrunner/test.py b/test/crossrunner/test.py
index dcc8a94..74fd916 100644
--- a/test/crossrunner/test.py
+++ b/test/crossrunner/test.py
@@ -124,8 +124,8 @@
return config
@classmethod
- def get_name(cls, server, client, proto, trans, sock, *args):
- return '%s-%s_%s_%s-%s' % (server, client, proto, trans, sock)
+ def get_name(cls, server, client, protocol, transport, socket, *args, **kwargs):
+ return '%s-%s_%s_%s-%s' % (server, client, protocol, transport, socket)
@property
def name(self):