Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
infra.py
Go to the documentation of this file.
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
8PYTHON_VERSION_COMPATIBILITY = "PY3"
9
10DEPS = [
11 'infra',
12 'recipe_engine/context',
13 'recipe_engine/path',
14 'recipe_engine/properties',
15 'recipe_engine/step',
16 'vars',
17]
18
19
20def git_init(api, repo_root, env):
21 with api.context(cwd=repo_root, env=env):
22 # Some tests assume that they're being run inside a git repo.
23 api.step('git init', cmd=['git', 'init'])
24 api.step('git add .', cmd=['git', 'add', '.'])
25 api.step('git commit', cmd=['git', 'commit', '-a', '-m', 'initial commit'])
26
27
28def RunSteps(api):
29 api.vars.setup()
30
31 # Run the infra tests.
32 repo_name = api.properties['repository'].split('/')[-1]
33 if repo_name.endswith('.git'):
34 repo_name = repo_name[:-len('.git')]
35 repo_root = api.path['start_dir'].join(repo_name)
36 infra_tests = repo_root.join('infra', 'bots', 'infra_tests.py')
37
38 # Merge the default environment with the Go environment.
39 env = {}
40 env.update(api.infra.go_env)
41 for k, v in api.vars.default_env.items():
42 # The PATH variable gets merged; all others get replaced.
43 if k == 'PATH':
44 # This works because the value for PATH in go_env and default_env includes
45 # the '%(PATH)s' placeholder.
46 env[k] = env[k] % {k: v}
47 else:
48 env[k] = v
49
50 git_init(api, repo_root, env)
51 if repo_name != 'skia':
52 git_init(api, api.path['start_dir'].join('skia'), env)
53
54 with api.context(cwd=repo_root, env=env):
55 # Unfortunately, the recipe tests are flaky due to file removal on Windows.
56 # Run multiple attempts.
57 last_exc = None
58 for _ in range(3):
59 try:
60 api.step('infra_tests', cmd=['python3', '-u', infra_tests])
61 break
62 except api.step.StepFailure as e: # pragma: nocover
63 last_exc = e
64 else: # pragma: nocover
65 raise last_exc
66
67def GenTests(api):
68 yield (
69 api.test('infra_tests') +
70 api.properties(buildername='Housekeeper-PerCommit-InfraTests_Linux',
71 repository='https://skia.googlesource.com/skia.git',
72 path_config='kitchen',
73 swarm_out_dir='[SWARM_OUT_DIR]')
74 )
75 yield (
76 api.test('infra_tests_lottie_ci') +
77 api.properties(buildername='Housekeeper-PerCommit-InfraTests_Linux',
78 repository='https://skia.googlesource.com/lottie-ci.git',
79 path_config='kitchen',
80 swarm_out_dir='[SWARM_OUT_DIR]')
81 )
RunSteps(api)
Definition infra.py:28
git_init(api, repo_root, env)
Definition infra.py:20
GenTests(api)
Definition infra.py:67