Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: infra/bots/recipes/swarm_test.py

Issue 2198973002: [Recipes] Move test and perf steps into test and perf recipes (Closed) Base URL: https://skia.googlesource.com/skia.git@fix_buildbot_spec
Patch Set: ready for review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/bots/recipes/swarm_perf.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 # Recipe module for Skia Swarming test. 6 # Recipe module for Skia Swarming test.
7 7
8 8
9 DEPS = [ 9 DEPS = [
10 'build/file',
10 'core', 11 'core',
11 'recipe_engine/json', 12 'recipe_engine/json',
12 'recipe_engine/path', 13 'recipe_engine/path',
13 'recipe_engine/platform', 14 'recipe_engine/platform',
14 'recipe_engine/properties', 15 'recipe_engine/properties',
16 'recipe_engine/python',
15 'recipe_engine/raw_io', 17 'recipe_engine/raw_io',
18 'flavor',
16 'run', 19 'run',
20 'vars',
17 ] 21 ]
18 22
19 23
20 TEST_BUILDERS = { 24 TEST_BUILDERS = {
21 'client.skia': { 25 'client.skia': {
22 'skiabot-linux-swarm-000': [ 26 'skiabot-linux-swarm-000': [
23 'Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug', 27 'Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug',
24 'Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Debug', 28 'Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Debug',
25 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug', 29 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug',
26 'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot', 30 'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage-Trybot',
27 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug', 31 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug',
28 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN', 32 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN',
29 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind', 33 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
30 'Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release-Trybot', 34 'Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release-Trybot',
31 ], 35 ],
32 }, 36 },
33 } 37 }
34 38
35 39
40 def key_params(api):
41 """Build a unique key from the builder name (as a list).
42
43 E.g. arch x86 gpu GeForce320M mode MacMini4.1 os Mac10.6
44 """
45 # Don't bother to include role, which is always Test.
46 # TryBots are uploaded elsewhere so they can use the same key.
47 blacklist = ['role', 'is_trybot']
48
49 flat = []
50 for k in sorted(api.vars.builder_cfg.keys()):
51 if k not in blacklist:
52 flat.append(k)
53 flat.append(api.vars.builder_cfg[k])
54 return flat
55
56
57 def test_steps(api):
58 """Run the DM test."""
59 use_hash_file = False
60 if api.vars.upload_dm_results:
61 # This must run before we write anything into
62 # api.flavor.device_dirs.dm_dir or we may end up deleting our
63 # output on machines where they're the same.
64 api.flavor.create_clean_host_dir(api.vars.dm_dir)
65 host_dm_dir = str(api.vars.dm_dir)
66 device_dm_dir = str(api.flavor.device_dirs.dm_dir)
67 if host_dm_dir != device_dm_dir:
68 api.flavor.create_clean_device_dir(device_dm_dir)
69
70 # Obtain the list of already-generated hashes.
71 hash_filename = 'uninteresting_hashes.txt'
72
73 # Ensure that the tmp_dir exists.
74 api.run.run_once(api.file.makedirs,
75 'tmp_dir',
76 api.vars.tmp_dir,
77 infra_step=True)
78
79 host_hashes_file = api.vars.tmp_dir.join(hash_filename)
80 hashes_file = api.flavor.device_path_join(
81 api.flavor.device_dirs.tmp_dir, hash_filename)
82 api.run(
83 api.python.inline,
84 'get uninteresting hashes',
85 program="""
86 import contextlib
87 import math
88 import socket
89 import sys
90 import time
91 import urllib2
92
93 HASHES_URL = 'https://gold.skia.org/_/hashes'
94 RETRIES = 5
95 TIMEOUT = 60
96 WAIT_BASE = 15
97
98 socket.setdefaulttimeout(TIMEOUT)
99 for retry in range(RETRIES):
100 try:
101 with contextlib.closing(
102 urllib2.urlopen(HASHES_URL, timeout=TIMEOUT)) as w:
103 hashes = w.read()
104 with open(sys.argv[1], 'w') as f:
105 f.write(hashes)
106 break
107 except Exception as e:
108 print 'Failed to get uninteresting hashes from %s:' % HASHES_URL
109 print e
110 if retry == RETRIES:
111 raise
112 waittime = WAIT_BASE * math.pow(2, retry)
113 print 'Retry in %d seconds.' % waittime
114 time.sleep(waittime)
115 """,
116 args=[host_hashes_file],
117 cwd=api.vars.skia_dir,
118 abort_on_failure=False,
119 fail_build_on_failure=False,
120 infra_step=True)
121
122 if api.path.exists(host_hashes_file):
123 api.flavor.copy_file_to_device(host_hashes_file, hashes_file)
124 use_hash_file = True
125
126 # Run DM.
127 properties = [
128 'gitHash', api.vars.got_revision,
129 'master', api.vars.master_name,
130 'builder', api.vars.builder_name,
131 'build_number', api.vars.build_number,
132 ]
133 if api.vars.is_trybot:
134 properties.extend([
135 'issue', api.vars.issue,
136 'patchset', api.vars.patchset,
137 ])
138
139 args = [
140 'dm',
141 '--undefok', # This helps branches that may not know new flags.
142 '--resourcePath', api.flavor.device_dirs.resource_dir,
143 '--skps', api.flavor.device_dirs.skp_dir,
144 '--images', api.flavor.device_path_join(
145 api.flavor.device_dirs.images_dir, 'dm'),
146 '--colorImages', api.flavor.device_path_join(
147 api.flavor.device_dirs.images_dir, 'colorspace'),
148 '--nameByHash',
149 '--properties'
150 ] + properties
151
152 args.append('--key')
153 args.extend(key_params(api))
154 if use_hash_file:
155 args.extend(['--uninterestingHashesFile', hashes_file])
156 if api.vars.upload_dm_results:
157 args.extend(['--writePath', api.flavor.device_dirs.dm_dir])
158
159 skip_flag = None
160 if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU':
161 skip_flag = '--nogpu'
162 elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU':
163 skip_flag = '--nocpu'
164 if skip_flag:
165 args.append(skip_flag)
166 args.extend(api.vars.dm_flags)
167
168 api.run(api.flavor.step, 'dm', cmd=args,
169 abort_on_failure=False,
170 env=api.vars.default_env)
171
172 if api.vars.upload_dm_results:
173 # Copy images and JSON to host machine if needed.
174 api.flavor.copy_directory_contents_to_host(
175 api.flavor.device_dirs.dm_dir, api.vars.dm_dir)
176
177 # See skia:2789.
178 if ('Valgrind' in api.vars.builder_name and
179 api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU'):
180 abandonGpuContext = list(args)
181 abandonGpuContext.append('--abandonGpuContext')
182 api.run(api.flavor.step, 'dm --abandonGpuContext',
183 cmd=abandonGpuContext, abort_on_failure=False)
184 preAbandonGpuContext = list(args)
185 preAbandonGpuContext.append('--preAbandonGpuContext')
186 api.run(api.flavor.step, 'dm --preAbandonGpuContext',
187 cmd=preAbandonGpuContext, abort_on_failure=False,
188 env=api.vars.default_env)
189
190
36 def RunSteps(api): 191 def RunSteps(api):
37 api.core.setup() 192 api.core.setup()
38 api.core.test_steps() 193 api.flavor.install()
39 api.core.cleanup_steps() 194 test_steps(api)
195 api.flavor.cleanup_steps()
40 api.run.check_failure() 196 api.run.check_failure()
41 197
42 198
43 def GenTests(api): 199 def GenTests(api):
44 def AndroidTestData(builder, adb=None): 200 def AndroidTestData(builder, adb=None):
45 test_data = ( 201 test_data = (
46 api.step_data( 202 api.step_data(
47 'get EXTERNAL_STORAGE dir', 203 'get EXTERNAL_STORAGE dir',
48 stdout=api.raw_io.output('/storage/emulated/legacy')) + 204 stdout=api.raw_io.output('/storage/emulated/legacy')) +
49 api.step_data( 205 api.step_data(
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 api.path.exists( 457 api.path.exists(
302 api.path['slave_build'].join('skia'), 458 api.path['slave_build'].join('skia'),
303 api.path['slave_build'].join('skia', 'infra', 'bots', 'assets', 459 api.path['slave_build'].join('skia', 'infra', 'bots', 'assets',
304 'skimage', 'VERSION'), 460 'skimage', 'VERSION'),
305 api.path['slave_build'].join('skia', 'infra', 'bots', 'assets', 461 api.path['slave_build'].join('skia', 'infra', 'bots', 'assets',
306 'skp', 'VERSION'), 462 'skp', 'VERSION'),
307 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt') 463 api.path['slave_build'].join('tmp', 'uninteresting_hashes.txt')
308 ) + 464 ) +
309 api.platform('win', 64) 465 api.platform('win', 64)
310 ) 466 )
OLDNEW
« no previous file with comments | « infra/bots/recipes/swarm_perf.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698