Do not run CheckNoStreamUsageIsAdded on tests.
No-Try: True Bug: None Change-Id: I8370b28b3a936e96cfd5382de4508c3809c61d93 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135462 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27867}
This commit is contained in:

committed by
Commit Bot

parent
630bd43fcf
commit
571791a63e
11
PRESUBMIT.py
11
PRESUBMIT.py
@ -498,9 +498,16 @@ def CheckNoStreamUsageIsAdded(input_api, output_api,
|
|||||||
r'// no-presubmit-check TODO\(webrtc:8982\)')
|
r'// no-presubmit-check TODO\(webrtc:8982\)')
|
||||||
file_filter = lambda x: (input_api.FilterSourceFile(x)
|
file_filter = lambda x: (input_api.FilterSourceFile(x)
|
||||||
and source_file_filter(x))
|
and source_file_filter(x))
|
||||||
|
|
||||||
|
def _IsException(file_path):
|
||||||
|
is_test = any(file_path.endswith(x) for x in ['_test.cc', '_tests.cc',
|
||||||
|
'_unittest.cc',
|
||||||
|
'_unittests.cc'])
|
||||||
|
return file_path.startswith('examples') or is_test
|
||||||
|
|
||||||
for f in input_api.AffectedSourceFiles(file_filter):
|
for f in input_api.AffectedSourceFiles(file_filter):
|
||||||
# Usage of stringstream is allowed under examples/.
|
# Usage of stringstream is allowed under examples/ and in tests.
|
||||||
if f.LocalPath() == 'PRESUBMIT.py' or f.LocalPath().startswith('examples'):
|
if f.LocalPath() == 'PRESUBMIT.py' or _IsException(f.LocalPath()):
|
||||||
continue
|
continue
|
||||||
for line_num, line in f.ChangedContents():
|
for line_num, line in f.ChangedContents():
|
||||||
if ((include_re.search(line) or usage_re.search(line))
|
if ((include_re.search(line) or usage_re.search(line))
|
||||||
|
Reference in New Issue
Block a user