Edit

kc3-lang/angle/infra/specs/generate_test_spec_json.py

Branch :

  • Show log

    Commit

  • Author : Yuly Novikov
    Date : 2021-06-10 16:09:01
    Hash : 166dd0c7
    Message : Roll chromium_revision 6c5859c895..399855f4bb (890175:891326) Manual changes: 1. Fix generate_test_spec_json.py to correctly handle ADDITIONAL_MIXINS Needed after angle_skia_gold_test mixin removed from Chromium in crrev.com/890333 2. Copy third_party/logdog from Chromium Needed after crrev.com/890539 in order to create isolates on Android and for tools/perf/process_perf_results.py Change log: https://chromium.googlesource.com/chromium/src/+log/6c5859c895..399855f4bb Full diff: https://chromium.googlesource.com/chromium/src/+/6c5859c895..399855f4bb Changed dependencies * build: https://chromium.googlesource.com/chromium/src/build.git/+log/8870cb4120..2192a63c23 * buildtools: https://chromium.googlesource.com/chromium/src/buildtools.git/+log/c793cca886..9d8449e380 * buildtools/linux64: git_revision:39a87c0b36310bdf06b692c098f199a0d97fc810..git_revision:393dab000d704a4364d085fa4c01ec7af176c8fa * buildtools/mac: git_revision:39a87c0b36310bdf06b692c098f199a0d97fc810..git_revision:393dab000d704a4364d085fa4c01ec7af176c8fa * buildtools/third_party/libc++abi/trunk: https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxxabi.git/+log/7e3b76855b..2c53623d59 * buildtools/win: git_revision:39a87c0b36310bdf06b692c098f199a0d97fc810..git_revision:393dab000d704a4364d085fa4c01ec7af176c8fa * testing: https://chromium.googlesource.com/chromium/src/testing/+log/a62f8260df..ab567bcc84 * third_party/abseil-cpp: https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp/+log/7949d87093..bd17c406ba * third_party/android_deps: https://chromium.googlesource.com/chromium/src/third_party/android_deps/+log/887e8d9009..fa47598982 * third_party/android_sdk: https://chromium.googlesource.com/chromium/src/third_party/android_sdk/+log/1cfc90728e..816daa2545 * third_party/catapult: https://chromium.googlesource.com/catapult.git/+log/{catapult_..17cf72ca75 * third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+log/b508ecd932..6d099d543d * third_party/nasm: https://chromium.googlesource.com/chromium/deps/nasm.git/+log/19f3fad68d..e9be5fd6d7 * third_party/protobuf: https://chromium.googlesource.com/chromium/src/third_party/protobuf/+log/82f8803671..f4241bd0f2 * third_party/turbine: _iPtB_ThhxlMOt2TsYqVppwriEEn0mp-NUNRwDwYLUAC..Om6yIEXgJxuqghErK29h9RcMH6VaymMbxwScwXmcN6EC * tools/clang: https://chromium.googlesource.com/chromium/src/tools/clang.git/+log/09481f56be..fd14318cc9 * tools/luci-go: git_revision:2cc9805d5ad186367461ef1c4f0c59098b450418..git_revision:725192cc79f07ea946e10a64baac06625c206968 * tools/luci-go: git_revision:2cc9805d5ad186367461ef1c4f0c59098b450418..git_revision:725192cc79f07ea946e10a64baac06625c206968 * tools/luci-go: git_revision:2cc9805d5ad186367461ef1c4f0c59098b450418..git_revision:725192cc79f07ea946e10a64baac06625c206968 * tools/mb: https://chromium.googlesource.com/chromium/src/tools/mb/+log/94630dfc19..12c8fa872b * tools/perf: https://chromium.googlesource.com/chromium/src/tools/perf/+log/5c84710692..2e6477d751 DEPS diff: https://chromium.googlesource.com/chromium/src/+/6c5859c895..399855f4bb/DEPS Clang version changed llvmorg-13-init-11999-g50c0aaed:llvmorg-13-init-12491-g055770d5 Details: https://chromium.googlesource.com/chromium/src/tools/clang/+/09481f56be7b1bbaf5a466be5d81691902825fcf..fd14318cc948b67e5ec8a0f2f7563142ccd6dac2/scripts/update.py Bug: angleproject:4483, angleproject:6037 Change-Id: I9035126bce55642d4dfce54eeace85093bdd1782 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2954241 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>

  • infra/specs/generate_test_spec_json.py
  • #!/usr/bin/env python
    # Copyright 2021 The ANGLE 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.
    """Script to generate the test spec JSON files. Calls Chromium's generate_buildbot_json.
    
    === NOTE: DO NOT RUN THIS SCRIPT DIRECTLY. ===
    Run scripts/run_code_generation.py instead to update necessary hashes.
    
    """
    
    import os
    import pprint
    import sys
    import subprocess
    
    d = os.path.dirname
    THIS_DIR = d(os.path.abspath(__file__))
    TESTING_BBOT_DIR = os.path.join(d(d(THIS_DIR)), 'testing', 'buildbot')
    sys.path.insert(0, TESTING_BBOT_DIR)
    
    import generate_buildbot_json
    
    # Add custom mixins here.
    ADDITIONAL_MIXINS = {
        'angle_skia_gold_test': {
            '$mixin_append': {
                'args': [
                    '--git-revision=${got_angle_revision}',
                    # BREAK GLASS IN CASE OF EMERGENCY
                    # Uncommenting this argument will bypass all interactions with Skia
                    # Gold in any tests that use it. This is meant as a temporary
                    # emergency stop in case of a Gold outage that's affecting the bots.
                    # '--bypass-skia-gold-functionality',
                ],
                'precommit_args': [
                    '--gerrit-issue=${patch_issue}',
                    '--gerrit-patchset=${patch_set}',
                    '--buildbucket-id=${buildbucket_build_id}',
                ],
            }
        },
    }
    MIXIN_FILE_NAME = os.path.join(THIS_DIR, 'mixins.pyl')
    MIXINS_PYL_TEMPLATE = """\
    # GENERATED FILE - DO NOT EDIT.
    # Generated by {script_name} using data from {data_source}
    #
    # Copyright 2021 The ANGLE 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.
    #
    # This is a .pyl, or "Python Literal", file. You can treat it just like a
    # .json file, with the following exceptions:
    # * all keys must be quoted (use single quotes, please);
    # * comments are allowed, using '#' syntax; and
    # * trailing commas are allowed.
    #
    # For more info see Chromium's mixins.pyl in testing/buildbot.
    
    {mixin_data}
    """
    
    
    def main():
        if len(sys.argv) > 1:
            gen_bb_json = os.path.join(TESTING_BBOT_DIR, 'generate_buildbot_json.py')
            mixins_pyl = os.path.join(TESTING_BBOT_DIR, 'mixins.pyl')
            inputs = [
                'test_suite_exceptions.pyl', 'test_suites.pyl', 'variants.pyl', 'waterfalls.pyl',
                gen_bb_json, mixins_pyl
            ]
            outputs = ['angle.json', 'mixins.pyl']
            if sys.argv[1] == 'inputs':
                print(','.join(inputs))
            elif sys.argv[1] == 'outputs':
                print(','.join(outputs))
            else:
                print('Invalid script parameters')
                return 1
            return 0
    
        chromium_args = generate_buildbot_json.BBJSONGenerator.parse_args(sys.argv[1:])
        chromium_generator = generate_buildbot_json.BBJSONGenerator(chromium_args)
        chromium_generator.load_configuration_files()
    
        override_args = sys.argv[1:] + ['--pyl-files-dir', THIS_DIR]
        angle_args = generate_buildbot_json.BBJSONGenerator.parse_args(override_args)
        angle_generator = generate_buildbot_json.BBJSONGenerator(angle_args)
        angle_generator.load_configuration_files()
        angle_generator.resolve_configuration_files()
    
        seen_mixins = set()
        for waterfall in angle_generator.waterfalls:
            seen_mixins = seen_mixins.union(waterfall.get('mixins', set()))
            for bot_name, tester in waterfall['machines'].iteritems():
                seen_mixins = seen_mixins.union(tester.get('mixins', set()))
        for suite in angle_generator.test_suites.values():
            if isinstance(suite, list):
                # Don't care about this, it's a composition, which shouldn't include a
                # swarming mixin.
                continue
            for test in suite.values():
                assert isinstance(test, dict)
                seen_mixins = seen_mixins.union(test.get('mixins', set()))
    
        found_mixins = ADDITIONAL_MIXINS.copy()
        for mixin in seen_mixins:
            if mixin in found_mixins:
                continue
            assert (mixin in chromium_generator.mixins)
            found_mixins[mixin] = chromium_generator.mixins[mixin]
    
        pp = pprint.PrettyPrinter(indent=2)
    
        format_data = {
            'script_name': os.path.basename(__file__),
            'data_source': 'waterfall.pyl and Chromium\'s mixins.pyl',
            'mixin_data': pp.pformat(found_mixins),
        }
        generated_mixin_pyl = MIXINS_PYL_TEMPLATE.format(**format_data)
    
        with open(MIXIN_FILE_NAME, 'w') as f:
            f.write(generated_mixin_pyl)
            f.close()
    
        return angle_generator.main()
    
    
    if __name__ == '__main__':  # pragma: no cover
        sys.exit(main())