| # Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file |
| # for details. All rights reserved. Use of this source code is governed by a |
| # BSD-style license that can be found in the LICENSE file. |
| |
| from recipe_engine import post_process |
| from RECIPE_MODULES.dart.dart import (ARCHITECTURES, CPUS, DEFAULT_CPU, MODES, |
| RUNTIMES, SANITIZERS, SYSTEMS) |
| |
| from PB.recipe_modules.dart.build.build import Build |
| |
| DEPS = [ |
| 'dart', |
| 'recipe_engine/json', |
| 'recipe_engine/platform', |
| 'recipe_engine/properties', |
| 'recipe_engine/step', |
| ] |
| |
| PYTHON_VERSION_COMPATIBILITY = 'PY3' |
| |
| |
| def RunSteps(api): |
| environment = api.dart._environment(api.properties.get('builder_name')) |
| api.step.empty('test').presentation.properties['environment'] = environment |
| |
| |
| def GenTests(api): |
| yield _test_environment(api, 'defaults', 'default', _defaults()) |
| for arch in ARCHITECTURES: |
| yield _test_environment( |
| api, arch, 'default-%s' % arch, |
| _defaults( |
| arch=arch, |
| build_root='out/Release%s' % arch.upper(), |
| cpu=CPUS.get(arch, DEFAULT_CPU))) |
| for mode in MODES: |
| yield _test_environment( |
| api, mode, 'default-%s' % mode, |
| _defaults(mode=mode, build_root='out/%sX64' % mode.capitalize())) |
| for runtime in RUNTIMES: |
| yield _test_environment(api, runtime, 'default-%s' % runtime, |
| _defaults(runtime=runtime)) |
| for sanitizer in SANITIZERS: |
| yield _test_environment(api, sanitizer, 'default-%s' % sanitizer, |
| _defaults(sanitizer=sanitizer)) |
| for system in SYSTEMS: |
| overrides = { |
| 'android': { |
| 'copy-coredumps': False, |
| }, |
| 'fuchsia': { |
| 'copy-coredumps': False, |
| }, |
| 'mac': { |
| 'build_root': 'xcodebuild/ReleaseX64', |
| 'out': 'xcodebuild', |
| }, |
| 'win': { |
| 'copy-coredumps': False, |
| } |
| } |
| test = _test_environment( |
| api, system, 'default-%s' % system, |
| _defaults(system=system, **overrides.get(system, {}))) |
| if system == 'mac': |
| yield api.platform('mac', 64) + test |
| else: |
| yield test |
| |
| yield _test_environment(api, 'vm-win', 'vm-win', _defaults(system='win')) |
| yield api.platform('mac', 64) + _test_environment( |
| api, 'complex-test-case', |
| 'complex-product-mac-test-riscv64-case-asan-chrome', |
| _defaults( |
| arch='riscv64', |
| build_root='xcodebuild/ProductRISCV64', |
| cpu='riscv64', |
| mode='product', |
| out='xcodebuild', |
| runtime='chrome', |
| sanitizer='asan', |
| system='mac')) |
| |
| |
| def _test_environment(api, name, builder_name, expected): |
| return api.test( |
| name, |
| api.properties(builder_name=builder_name), |
| api.post_check(post_process.PropertyEquals, 'environment', expected), |
| api.post_process(post_process.StatusSuccess), |
| api.post_process(post_process.DropExpectation), |
| ) |
| |
| |
| def _defaults(**kwargs): |
| defaults = { |
| 'arch': 'x64', |
| 'build_root': 'out/ReleaseX64', |
| 'copy-coredumps': True, |
| 'cpu': 'x86-64', |
| 'mode': 'release', |
| 'out': 'out', |
| 'packages': { |
| 'dart/dart-sdk/${platform}': [ |
| 'dart/dart-sdk/${platform}', |
| 'version:2.9.0-18.0.dev', |
| 'tools/sdks', |
| ], |
| 'dart/third_party/co19': [ |
| 'dart/third_party/co19', |
| 'git_revision:co19_hash', |
| 'tests/co19/src', |
| ], |
| 'dart/third_party/co19/legacy': [ |
| 'dart/third_party/co19/legacy', |
| 'git_revision:co19_2_hash', |
| 'tests/co19_2/src', |
| ] |
| }, |
| 'runtime': None, |
| 'sanitizer': 'none', |
| 'system': 'linux', |
| } |
| defaults.update(**kwargs) |
| return defaults |