diff --git a/test/sequential/testcfg.py b/test/sequential/testcfg.py index b1fce1810017f1..7a196b27caa150 100644 --- a/test/sequential/testcfg.py +++ b/test/sequential/testcfg.py @@ -3,4 +3,4 @@ import testpy def GetConfiguration(context, root): - return testpy.SimpleTestConfiguration(context, root, 'sequential') + return testpy.SimpleTestConfiguration(context, root, 'sequential', allow_recursion=True) diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index 46abdf6e53c919..d51cfd674e4a33 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -94,18 +94,24 @@ def GetSource(self): class SimpleTestConfiguration(test.TestConfiguration): - def __init__(self, context, root, section, additional=None): + def __init__(self, context, root, section, additional=None, allow_recursion=False): super(SimpleTestConfiguration, self).__init__(context, root, section) + self.allow_recursion = allow_recursion if additional is not None: self.additional_flags = additional else: self.additional_flags = [] def Ls(self, path): - return [f for f in os.listdir(path) if LS_RE.match(f)] + if self.allow_recursion: + return [os.path.relpath(os.path.join(dp, f), path) + for dp, dn, filenames in os.walk(path) + for f in filenames if LS_RE.match(f)] + else: + return [f for f in os.listdir(path) if LS_RE.match(f)] def ListTests(self, current_path, path, arch, mode): - all_tests = [current_path + [t] for t in self.Ls(os.path.join(self.root))] + all_tests = [current_path + t.split(os.path.sep) for t in self.Ls(os.path.join(self.root))] result = [] for tst in all_tests: if self.Contains(path, tst): @@ -121,7 +127,7 @@ def GetBuildRequirements(self): class ParallelTestConfiguration(SimpleTestConfiguration): def __init__(self, context, root, section, additional=None): super(ParallelTestConfiguration, self).__init__(context, root, section, - additional) + additional, allow_recursion=True) def ListTests(self, current_path, path, arch, mode): result = super(ParallelTestConfiguration, self).ListTests( diff --git a/tools/test.py b/tools/test.py index 9d7838d7c0110a..b2b6eabbe1114d 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1596,6 +1596,7 @@ def ArgsToTestPaths(test_root, args, suites): subsystem_regex = re.compile(r'^[a-zA-Z-]*$') check = lambda arg: subsystem_regex.match(arg) and (arg not in suites) mapped_args = ["*/test*-%s-*" % arg if check(arg) else arg for arg in args] + mapped_args += ["*/%s/test*" % arg for arg in args] paths = [SplitPath(NormalizePath(a)) for a in mapped_args] return paths