Add pyl files to generate the tests config.
The config is only added for the bot luci.webrtc.ci:"Linux64 Release" as a proof of concept. Bug: webrtc:13899 Change-Id: I5ac37da5f63ca4b1c346dffe43e635b2c55e0c01 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257160 Reviewed-by: Christoffer Jansson <jansson@google.com> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Jeremy Leconte <jleconte@google.com> Cr-Commit-Position: refs/heads/main@{#36417}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
c9e796dffc
commit
0c4059c4c8
89
infra/specs/generate_buildbot_json.py
Executable file
89
infra/specs/generate_buildbot_json.py
Executable file
@ -0,0 +1,89 @@
|
||||
#!/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.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
_SRC_DIR = os.path.dirname(os.path.dirname(_SCRIPT_DIR))
|
||||
sys.path.insert(0, _SRC_DIR)
|
||||
sys.path.insert(0, os.path.join(_SRC_DIR, 'testing', 'buildbot'))
|
||||
|
||||
from testing.buildbot import generate_buildbot_json
|
||||
|
||||
# Add custom mixins here.
|
||||
ADDITIONAL_MIXINS = {
|
||||
'result_adapter': {
|
||||
'resultdb': {
|
||||
'result_format': 'json'
|
||||
},
|
||||
},
|
||||
}
|
||||
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}
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
chromium_args = generate_buildbot_json.BBJSONGenerator.parse_args(argv=None)
|
||||
chromium_generator = generate_buildbot_json.BBJSONGenerator(chromium_args)
|
||||
chromium_generator.load_configuration_files()
|
||||
|
||||
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()
|
||||
|
||||
seen_mixins = set()
|
||||
for waterfall in webrtc_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 webrtc_generator.test_suites.values():
|
||||
for test in suite.values():
|
||||
seen_mixins = seen_mixins.union(test.get('mixins', set()))
|
||||
|
||||
found_mixins = ADDITIONAL_MIXINS.copy()
|
||||
for mixin in seen_mixins:
|
||||
if mixin not in found_mixins:
|
||||
found_mixins[mixin] = chromium_generator.mixins[mixin]
|
||||
|
||||
format_data = {
|
||||
'script_name': os.path.basename(__file__),
|
||||
'data_source': 'waterfall.pyl and Chromium\'s mixins.pyl',
|
||||
'mixin_data': json.dumps(dict(sorted(found_mixins.items())), indent=2),
|
||||
}
|
||||
with open(MIXIN_FILE_NAME, 'w') as f:
|
||||
f.write(MIXINS_PYL_TEMPLATE.format(**format_data))
|
||||
f.close()
|
||||
|
||||
return webrtc_generator.main()
|
||||
|
||||
|
||||
if __name__ == '__main__': # pragma: no cover
|
||||
sys.exit(main())
|
Reference in New Issue
Block a user