From d2c8332e2b033801b396ab2f2430a1579d7dec5a Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Mon, 19 Mar 2018 10:31:47 +0000 Subject: Revert "Relaxing no-streams presubmit check (streams are allowed in tests)." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 73ac90863d339599e6fc42fc5228282f479ebc0d. Reason for revert: Sometimes 'gn refs' exits with status 1. Original change's description: > Relaxing no-streams presubmit check (streams are allowed in tests). > > It is actually fine to use streams in testonly code. This CL relaxes > the presubmit check in order allow streams usage in tests. > > Bug: webrtc:8982 > Change-Id: I18bbf079e804815956cd94ac761cc13022c0761e > No-Try: True > Reviewed-on: https://webrtc-review.googlesource.com/61701 > Commit-Queue: Mirko Bonadei > Reviewed-by: Patrik Höglund > Reviewed-by: Sebastian Jansson > Reviewed-by: Tomas Gunnarsson > Cr-Commit-Position: refs/heads/master@{#22482} TBR=phoglund@webrtc.org,mbonadei@webrtc.org,tommi@webrtc.org,srte@webrtc.org,tommi@chromium.org Change-Id: I053b953896ca66be26835b60fb245d5ac0832294 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:8982 Reviewed-on: https://webrtc-review.googlesource.com/62780 Reviewed-by: Mirko Bonadei Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#22485} --- PRESUBMIT.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'PRESUBMIT.py') diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 96cdbf1d13..e533507ac0 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -410,10 +410,6 @@ def _ReportErrorFileAndLineNumber(filename, line_num): def CheckNoStreamUsageIsAdded(input_api, output_api, error_formatter=_ReportErrorFileAndLineNumber): """Make sure that no more dependencies on stringstream are added.""" - with _AddToPath(input_api.os_path.join( - input_api.PresubmitLocalPath(), 'tools_webrtc', 'presubmit_checks_lib')): - from gn_refs import DefaultGnProject, BelongsToTestTarget - error_msg = ('Usage of , and in WebRTC is ' 'deprecated.\n' 'This includes the following types:\n' @@ -437,15 +433,13 @@ def CheckNoStreamUsageIsAdded(input_api, output_api, usage_re = input_api.re.compile(r'std::(w|i|o|io|wi|wo|wio)(string)*stream') no_presubmit_re = input_api.re.compile( r' // no-presubmit-check TODO\(webrtc:8982\)') - is_cpp_file = lambda f: f.LocalPath().endswith(('.cc', '.h')) - with DefaultGnProject() as out_dir: - for f in input_api.AffectedFiles(file_filter=is_cpp_file): - if BelongsToTestTarget(f.LocalPath(), out_dir): - continue - for line_num, line in f.ChangedContents(): - if ((include_re.search(line) or usage_re.search(line)) - and not no_presubmit_re.search(line)): - errors.append(error_formatter(f.LocalPath(), line_num)) + for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): + if f.LocalPath() == 'PRESUBMIT.py': + continue + for line_num, line in f.ChangedContents(): + if ((include_re.search(line) or usage_re.search(line)) + and not no_presubmit_re.search(line)): + errors.append(error_formatter(f.LocalPath(), line_num)) if errors: return [output_api.PresubmitError(error_msg, errors)] return [] -- cgit v1.2.3