1# Copyright 2016 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5
6# Recipe which runs the Skia infra tests.
7
8
9DEPS = [
10  'recipe_engine/context',
11  'recipe_engine/path',
12  'recipe_engine/properties',
13  'recipe_engine/step',
14  'core',
15  'infra',
16  'run',
17  'vars',
18]
19
20
21def RunSteps(api):
22  api.vars.setup()
23  api.core.checkout_steps()
24  api.infra.update_go_deps()
25
26  # Run the infra tests.
27  repo_name = api.properties['repository'].split('/')[-1]
28  if repo_name.endswith('.git'):
29    repo_name = repo_name[:-len('.git')]
30  with api.context(cwd=api.vars.checkout_root.join(repo_name),
31                   env=api.infra.go_env):
32    api.step('infra_tests', cmd=['make', '-C', 'infra/bots', 'test'])
33
34
35def GenTests(api):
36  yield (
37      api.test('infra_tests') +
38      api.properties(buildername='Housekeeper-PerCommit-InfraTests',
39                     repository='https://skia.googlesource.com/skia.git',
40                     revision='abc123',
41                     path_config='kitchen',
42                     swarm_out_dir='[SWARM_OUT_DIR]')
43  )
44
45  yield (
46    api.test('failed_one_update') +
47      api.properties(buildername='Housekeeper-PerCommit-InfraTests',
48                     repository='https://skia.googlesource.com/skia.git',
49                     revision='abc123',
50                     path_config='kitchen',
51                     swarm_out_dir='[SWARM_OUT_DIR]') +
52    api.step_data('update go pkgs', retcode=1)
53  )
54
55  yield (
56    api.test('failed_all_updates') +
57      api.properties(buildername='Housekeeper-PerCommit-InfraTests',
58                     repository='https://skia.googlesource.com/skia.git',
59                     revision='abc123',
60                     path_config='kitchen',
61                     swarm_out_dir='[SWARM_OUT_DIR]') +
62    api.step_data('update go pkgs', retcode=1) +
63    api.step_data('update go pkgs (attempt 2)', retcode=1) +
64    api.step_data('update go pkgs (attempt 3)', retcode=1) +
65    api.step_data('update go pkgs (attempt 4)', retcode=1) +
66    api.step_data('update go pkgs (attempt 5)', retcode=1)
67  )
68