| # Copyright 2017 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| from PB.infra.fuchsia import Fuchsia |
| from recipe_engine.recipe_api import Property |
| |
| DEPS = [ |
| 'fuchsia/build_input_resolver', |
| 'fuchsia/fuchsia', |
| 'fuchsia/gitiles', |
| 'fuchsia/spec', |
| 'fuchsia/status_check', |
| 'recipe_engine/buildbucket', |
| 'recipe_engine/properties', |
| ] |
| |
| PROPERTIES = { |
| 'spec_remote': |
| Property( |
| kind=str, |
| help='URL of the specs git repository', |
| default='https://fuchsia.googlesource.com/integration'), |
| 'spec_revision': |
| Property( |
| kind=str, |
| help='The revision of spec_remote to fetch', |
| default='HEAD'), |
| } |
| |
| |
| def RunSteps(api, spec_remote, spec_revision): |
| api.fuchsia.setup_with_spec(spec_remote, spec_revision) |
| |
| |
| def GenTests(api): |
| |
| def spec_data(use_snapshot=False, |
| build_type='debug', |
| ninja_targets=(), |
| sdk_subbuild=False, |
| variants=(), |
| device_type='QEMU', |
| enforce_size_limits=False, |
| run_tests=True, |
| test_in_shards=True, |
| gcs_bucket=None, |
| pave=True): |
| test_spec = None |
| if run_tests: |
| test_spec = Fuchsia.Test( |
| device_type=device_type, |
| max_shard_size=0, |
| target_shard_duration_secs=10 * 60, |
| max_shards_per_env=8, |
| timeout_secs=30 * 60, |
| pool='fuchsia.tests', |
| test_in_shards=test_in_shards, |
| swarming_expiration_timeout_secs=10 * 60, |
| swarming_io_timeout_secs=5 * 60, |
| default_service_account='service_account', |
| targets_serial=True, |
| pave=pave, |
| ) |
| |
| spec = Fuchsia( |
| checkout=Fuchsia.Checkout( |
| manifest='minimal', |
| project='integration', |
| remote='https://fuchsia.googlesource.com/manifest', |
| upload_results=bool(gcs_bucket), |
| use_snapshot=use_snapshot, |
| ), |
| build=Fuchsia.Build( |
| variants=variants, |
| build_type=build_type, |
| run_tests=run_tests, |
| ninja_targets=ninja_targets, |
| sdk_subbuild=sdk_subbuild, |
| board='boards/x64.gni', |
| product='products/core.gni', |
| target='x64', |
| include_breakpad_symbols=False, |
| enforce_size_limits=enforce_size_limits, |
| upload_results=bool(gcs_bucket), |
| ), |
| test=test_spec, |
| gcs_bucket=gcs_bucket, |
| artifact_gcs_bucket='fuchsia-infra-artifacts', |
| ) |
| return api.spec.spec_loaded_ok( |
| step_name='load spec.build_init', message=spec) |
| |
| default_gitiles_refs_steps = api.gitiles.refs('refs', [ |
| 'refs/heads/master', |
| 'deadbeef', |
| ]) |
| |
| spec_remote = 'https://fuchsia.googlesource.com/integration' |
| |
| yield (api.test('default') + api.buildbucket.ci_build() + |
| spec_data(gcs_bucket='fuchsia-infra', run_tests=True)) |
| |
| yield (api.test('setup_with_spec_revision') + api.buildbucket.ci_build() + |
| spec_data(gcs_bucket='fuchsia-infra', run_tests=True) + |
| api.properties(spec_revision='deadbeef')) |
| |
| yield (api.test('spec_remote_cq') + spec_data(run_tests=True) + |
| api.buildbucket.try_build(git_repo=spec_remote) + |
| api.build_input_resolver.set_gerrit_branch('master') + |
| default_gitiles_refs_steps + api.properties(spec_remote=spec_remote)) |
| |
| yield (api.test('spec_remote_cq_with_spec_revision') + |
| spec_data(run_tests=True) + |
| api.buildbucket.try_build(git_repo=spec_remote) + |
| api.build_input_resolver.set_gerrit_branch('master') + |
| default_gitiles_refs_steps + |
| api.properties(spec_remote=spec_remote, spec_revision='deadbeef2')) |
| |
| yield (api.status_check.test('spec_parse_error', status='failure') + |
| api.buildbucket.ci_build() + |
| api.spec.spec_parse_error(step_name='load spec.build_init')) |