| Index: presubmit_canned_checks.py
|
| diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
|
| index bd3c361f2742f1145df08607e22f754f7b61b705..56031b2c9828dfdfa9b82329751320e4f884b4c5 100644
|
| --- a/presubmit_canned_checks.py
|
| +++ b/presubmit_canned_checks.py
|
| @@ -562,6 +562,36 @@ def GetUnitTests(input_api, output_api, unit_tests, env=None):
|
| return results
|
|
|
|
|
| +def GetUnitTestsRecursively(input_api, output_api, directory,
|
| + whitelist, blacklist):
|
| + """Gets all files in the directory tree (git repo) that match the whitelist.
|
| +
|
| + Restricts itself to only find files within the Change's source repo, not
|
| + dependencies.
|
| + """
|
| + def check(filename):
|
| + return (any(input_api.re.match(f, filename) for f in whitelist) and
|
| + not any(input_api.re.match(f, filename) for f in blacklist))
|
| +
|
| + tests = []
|
| +
|
| + to_run = found = 0
|
| + for filepath in input_api.change.AllFiles(directory):
|
| + found += 1
|
| + if check(filepath):
|
| + to_run += 1
|
| + tests.append(filepath)
|
| + input_api.logging.debug('Found %d files, running %d' % (found, to_run))
|
| + if not to_run:
|
| + return [
|
| + output_api.PresubmitPromptWarning(
|
| + 'Out of %d files, found none that matched w=%r, b=%r in directory %s'
|
| + % (found, whitelist, blacklist, directory))
|
| + ]
|
| +
|
| + return GetUnitTests(input_api, output_api, tests)
|
| +
|
| +
|
| def GetPythonUnitTests(input_api, output_api, unit_tests):
|
| """Run the unit tests out of process, capture the output and use the result
|
| code to determine success.
|
| @@ -744,7 +774,7 @@ def GetPylint(input_api, output_api, white_list=None, black_list=None,
|
| if True:
|
| return [GetPylintCmd(files)]
|
| else:
|
| - return map(GetPylintCmd, files)
|
| + return map(lambda x: GetPylintCmd([x]), files)
|
|
|
|
|
| def RunPylint(input_api, *args, **kwargs):
|
|
|