webrtc/infra/specs/PRESUBMIT.py
Mirko Bonadei 5c8993cba0 Reland "Add 2 additional tests config in waterfalls.pyl."
This reverts commit b5ab062a3e.

Reason for revert: The CL was not the culprit.

Original change's description:
> Revert "Add 2 additional tests config in waterfalls.pyl."
>
> This reverts commit 429c1bd74d.
>
> Reason for revert: It breaks some CQ bots (e.g. https://ci.chromium.org/ui/p/webrtc/builders/try/linux_compile_rel/42825/overview). I am reverting to check is this is the culprit.
>
> Original change's description:
> > Add 2 additional tests config in waterfalls.pyl.
> >
> > * Add a presubmit check that generate_builbot_json.py has been called.
> > * Add a webrtc_mixins.pyl file.
> >
> > Bug: webrtc:13899
> > Change-Id: I7c4226ddd80bf9376bcb91476a1446a0392e7ec6
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257904
> > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> > Commit-Queue: Jeremy Leconte <jleconte@google.com>
> > Cr-Commit-Position: refs/heads/main@{#36428}
>
> Bug: webrtc:13899
> Change-Id: Ic79306688c26937a988a9eacb4799f53f7145c65
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257919
> Auto-Submit: Mirko Bonadei <mbonadei@webrtc.org>
> Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#36431}

Bug: webrtc:13899
Change-Id: Id0ac9a98744fa5019cbb69bbd1e53e138f887e9e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257980
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36433}
2022-04-04 19:11:38 +00:00

66 lines
2.3 KiB
Python

# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import os
def _HasLocalChanges(input_api):
ret = input_api.subprocess.call(['git', 'diff', '--quiet'])
return ret != 0
def CheckPatchFormatted(input_api, output_api):
results = []
file_filter = lambda x: x.LocalPath().endswith('.pyl')
affected_files = input_api.AffectedFiles(include_deletes=False,
file_filter=file_filter)
for f in affected_files:
cmd = ['yapf', '-i', f.AbsoluteLocalPath()]
if input_api.subprocess.call(cmd):
results.append(output_api.PresubmitError('Error calling "' + cmd + '"'))
if _HasLocalChanges(input_api):
msg = ('Diff found after running "yapf -i" on modified .pyl files.\n'
'Please commit or discard the new changes.')
results.append(output_api.PresubmitError(msg))
return results
def CheckSourceSideSpecs(input_api, output_api):
d = os.path.dirname
angle_root = d(d(input_api.PresubmitLocalPath()))
gen_script = os.path.join(angle_root, 'testing', 'buildbot',
'generate_buildbot_json.py')
commands = [
input_api.Command(name='generate_buildbot_json',
cmd=[
input_api.python_executable, gen_script, '--check',
'--verbose', '--pyl-files-dir',
input_api.PresubmitLocalPath()
],
kwargs={},
message=output_api.PresubmitError),
]
return input_api.RunTests(commands)
def CheckChangeOnUpload(input_api, output_api):
results = []
results.extend(CheckPatchFormatted(input_api, output_api))
results.extend(CheckSourceSideSpecs(input_api, output_api))
return results
def CheckChangeOnCommit(input_api, output_api):
results = []
results.extend(CheckPatchFormatted(input_api, output_api))
results.extend(CheckSourceSideSpecs(input_api, output_api))
return results