webrtc_m130/infra/specs/generate_buildbot_json.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
3.6 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env vpython3
# 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.
"""Script to generate the test spec JSON files and the mixins.pyl file from the
ADDITIONAL_MIXINS dictonary. Calls Chromium's generate_buildbot_json.
"""
Reland "Add 2 additional tests config in waterfalls.pyl." This reverts commit b5ab062a3e384bf20e9d916211f824bc59b3f62d. 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 429c1bd74d5b821a360be6a215bcbe7c422bedeb. > > 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 18:43:54 +00:00
import ast
import os
Reland "Add 2 additional tests config in waterfalls.pyl." This reverts commit b5ab062a3e384bf20e9d916211f824bc59b3f62d. 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 429c1bd74d5b821a360be6a215bcbe7c422bedeb. > > 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 18:43:54 +00:00
import subprocess
import sys
_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
_SRC_DIR = os.path.dirname(os.path.dirname(_SCRIPT_DIR))
_TESTING_BBOT_DIR = os.path.join(_SRC_DIR, 'testing', 'buildbot')
sys.path.insert(0, _SRC_DIR)
sys.path.insert(0, _TESTING_BBOT_DIR)
from testing.buildbot import generate_buildbot_json
# Add custom mixins here.
Reland "Add 2 additional tests config in waterfalls.pyl." This reverts commit b5ab062a3e384bf20e9d916211f824bc59b3f62d. 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 429c1bd74d5b821a360be6a215bcbe7c422bedeb. > > 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 18:43:54 +00:00
WEBRTC_MIXIN_FILE_NAME = os.path.join(_SCRIPT_DIR, 'mixins_webrtc.pyl')
MIXIN_FILE_NAME = os.path.join(_SCRIPT_DIR, 'mixins.pyl')
MIXINS_PYL_TEMPLATE = """\
# GENERATED FILE - DO NOT EDIT.
# Generated by {script_name} using data from
# {data_source}
#
# 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.
{mixin_data}
"""
Reland "Add 2 additional tests config in waterfalls.pyl." This reverts commit b5ab062a3e384bf20e9d916211f824bc59b3f62d. 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 429c1bd74d5b821a360be6a215bcbe7c422bedeb. > > 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 18:43:54 +00:00
def generate_mixins_file_from_used_mixins(generator):
chromium_mixins = generator.load_pyl_file(
os.path.join(_TESTING_BBOT_DIR, 'mixins.pyl'))
seen_mixins = set()
for waterfall in generator.waterfalls:
seen_mixins = seen_mixins.union(waterfall.get('mixins', set()))
for bot_name, tester in waterfall['machines'].items():
del bot_name
seen_mixins = seen_mixins.union(tester.get('mixins', set()))
for suite in generator.test_suites.values():
for test in suite.values():
if isinstance(test, list):
# This is for mixins defined in variants.pyl.
for variant in test:
seen_mixins = seen_mixins.union(
variant.get('mixins', set()))
else:
seen_mixins = seen_mixins.union(test.get('mixins', set()))
found_mixins = ast.literal_eval(open(WEBRTC_MIXIN_FILE_NAME).read())
for mixin in seen_mixins:
if mixin not in found_mixins:
found_mixins[mixin] = chromium_mixins[mixin]
elif mixin in chromium_mixins:
assert False, (
'"%s" is already defined in Chromium\'s mixins.pyl' % mixin)
format_data = {
'script_name': os.path.basename(__file__),
'data_source': 'mixins_webrtc.pyl and Chromium\'s mixins.pyl',
'mixin_data': dict(sorted(found_mixins.items())),
}
with open(MIXIN_FILE_NAME, 'w') as f:
f.write(MIXINS_PYL_TEMPLATE.format(**format_data))
return subprocess.call(['yapf', '-i', MIXIN_FILE_NAME])
Reland "Add 2 additional tests config in waterfalls.pyl." This reverts commit b5ab062a3e384bf20e9d916211f824bc59b3f62d. 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 429c1bd74d5b821a360be6a215bcbe7c422bedeb. > > 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 18:43:54 +00:00
def main():
override_args = ['--pyl-files-dir', _SCRIPT_DIR]
webrtc_args = generate_buildbot_json.BBJSONGenerator.parse_args(
override_args)
webrtc_generator = generate_buildbot_json.BBJSONGenerator(webrtc_args)
webrtc_generator.load_configuration_files()
webrtc_generator.resolve_configuration_files()
Reland "Add 2 additional tests config in waterfalls.pyl." This reverts commit b5ab062a3e384bf20e9d916211f824bc59b3f62d. 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 429c1bd74d5b821a360be6a215bcbe7c422bedeb. > > 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 18:43:54 +00:00
generate_mixins_file_from_used_mixins(webrtc_generator)
return webrtc_generator.main()
if __name__ == '__main__': # pragma: no cover
sys.exit(main())