Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
full.py
Go to the documentation of this file.
1# Copyright 2017 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
5PYTHON_VERSION_COMPATIBILITY = "PY3"
6
7DEPS = [
8 'recipe_engine/context',
9 'recipe_engine/path',
10 'recipe_engine/platform',
11 'recipe_engine/properties',
12 'recipe_engine/step',
13 'run',
14 'vars',
15]
16
17
18def myfunc(api, i):
19 api.run(api.step, 'run %d' % i, cmd=['echo', str(i)])
20
21
22def RunSteps(api):
23 api.vars.setup()
24 try:
25 api.run(api.step, 'fail', cmd=['false'])
26 except api.step.StepFailure:
27 pass
28 api.run(api.step, 'fail again', cmd=['false'], abort_on_failure=False)
29 api.run(api.step, 'do a thing', cmd=['echo', 'do the thing'])
30 assert len(api.run.failed_steps) == 2
31
32 # Run once.
33 for i in range(10):
34 api.run.run_once(myfunc, api, i)
35
36 # Read and write files.
37 api.run.readfile('myfile.txt')
38 api.run.writefile('myfile.txt', 'contents')
39 api.run.rmtree('mydir')
40 api.run.asset_version('my_asset', api.vars.cache_dir.join('work', 'skia'))
41
42 # Merge PATHs.
43 with api.context(env={'PATH': 'mydir:%(PATH)s'}):
44 api.run(api.step, 'env', cmd=['env'])
45
46 def between_attempts_fn(attempt):
47 api.run(api.step, 'between_attempts #%d' % attempt,
48 cmd=['echo', 'between_attempt'])
49
50 # Retries.
51 try:
52 api.run.with_retry(api.step, 'retry fail', 5, cmd=['false'],
53 between_attempts_fn=between_attempts_fn)
54 except api.step.StepFailure:
55 pass
56 assert len(api.run.failed_steps) == 7
57
58 api.run.with_retry(api.step, 'retry success', 3, cmd=['false'],
59 between_attempts_fn=between_attempts_fn)
60 assert len(api.run.failed_steps) == 7
61
62 # Check failure.
63 api.run.check_failure()
64
65
66def GenTests(api):
67 buildername = 'Build-Win-Clang-x86_64-Release-Vulkan'
68 yield (
69 api.test('test') +
70 api.properties(buildername=buildername,
71 repository='https://skia.googlesource.com/skia.git',
72 revision='abc123',
73 path_config='kitchen',
74 swarm_out_dir='[SWARM_OUT_DIR]') +
75 api.platform('win', 64) +
76 api.step_data('fail', retcode=1) +
77 api.step_data('fail again', retcode=1) +
78 api.step_data('retry fail', retcode=1) +
79 api.step_data('retry fail (attempt 2)', retcode=1) +
80 api.step_data('retry fail (attempt 3)', retcode=1) +
81 api.step_data('retry fail (attempt 4)', retcode=1) +
82 api.step_data('retry fail (attempt 5)', retcode=1) +
83 api.step_data('retry success', retcode=1) +
84 api.step_data('retry success (attempt 2)', retcode=1)
85 )
RunSteps(api)
Definition full.py:18
myfunc(api, i)
Definition full.py:18
GenTests(api)
Definition full.py:111