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 module for Skia Swarming test.
7
8
9DEPS = [
10  'core',
11  'env',
12  'flavor',
13  'recipe_engine/context',
14  'recipe_engine/file',
15  'recipe_engine/json',
16  'recipe_engine/path',
17  'recipe_engine/platform',
18  'recipe_engine/properties',
19  'recipe_engine/python',
20  'recipe_engine/raw_io',
21  'recipe_engine/step',
22  'run',
23  'vars',
24]
25
26
27def dm_flags(api, bot):
28  args = []
29  configs = []
30  blacklisted = []
31
32  def blacklist(quad):
33    config, src, options, name = quad.split(' ') if type(quad) is str else quad
34    if (config == '_' or
35        config in configs or
36        (config[0] == '~' and config[1:] in configs)):
37      blacklisted.extend([config, src, options, name])
38
39  # We've been spending lots of time writing out and especially uploading
40  # .pdfs, but not doing anything further with them.  skia:6821
41  args.extend(['--dont_write', 'pdf'])
42
43  # This enables non-deterministic random seeding of the GPU FP optimization
44  # test.
45  # Not Android due to:
46  #  - https://skia.googlesource.com/skia/+/
47  #    5910ed347a638ded8cd4c06dbfda086695df1112/BUILD.gn#160
48  #  - https://skia.googlesource.com/skia/+/
49  #    ce06e261e68848ae21cac1052abc16bc07b961bf/tests/ProcessorTest.cpp#307
50  # Not MSAN due to:
51  #  - https://skia.googlesource.com/skia/+/
52  #    0ac06e47269a40c177747310a613d213c95d1d6d/infra/bots/recipe_modules/
53  #    flavor/gn_flavor.py#80
54  if 'Android' not in bot and 'MSAN' not in bot:
55    args.append('--randomProcessorTest')
56
57  # 32-bit desktop bots tend to run out of memory, because they have relatively
58  # far more cores than RAM (e.g. 32 cores, 3G RAM).  Hold them back a bit.
59  if '-x86-' in bot and not 'NexusPlayer' in bot:
60    args.extend(['--threads', '4'])
61
62  # Nexus7 runs out of memory due to having 4 cores and only 1G RAM.
63  if 'CPU' in bot and 'Nexus7' in bot:
64    args.extend(['--threads', '2'])
65
66  if 'Chromecast' in bot:
67    args.extend(['--threads', '0'])
68
69  # Avoid issues with dynamically exceeding resource cache limits.
70  if 'Test' in bot and 'DISCARDABLE' in bot:
71    args.extend(['--threads', '0'])
72
73  # See if staying on the main thread helps skia:6748.
74  if 'Test-iOS' in bot:
75    args.extend(['--threads', '0'])
76
77  # Android's kernel will occasionally attempt to kill our process, using
78  # SIGINT, in an effort to free up resources. If requested, that signal
79  # is ignored and dm will keep attempting to proceed until we actually
80  # exhaust the available resources.
81  if ('NexusPlayer' in bot or
82      'PixelC' in bot or
83      'Chromecast' in bot):
84    args.append('--ignoreSigInt')
85
86  if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU':
87    args.append('--nogpu')
88
89    # These are the canonical configs that we would ideally run on all bots. We
90    # may opt out or substitute some below for specific bots
91    configs.extend(['8888', 'srgb', 'pdf'])
92
93    # Runs out of memory on Android bots. Everyone else seems fine.
94    if 'Android' in bot:
95      configs.remove('pdf')
96
97    if '-GCE-' in bot:
98      configs.extend(['g8'])
99      configs.extend(['565'])
100      configs.extend(['f16'])
101      configs.extend(['lite-8888'])              # Experimental display list.
102      configs.extend(['gbr-8888'])
103
104    configs.extend(mode + '-8888' for mode in ['serialize', 'tiles_rt', 'pic'])
105
106    # This bot only differs from vanilla CPU bots in 8888 config.
107    if 'SK_FORCE_RASTER_PIPELINE_BLITTER' in bot:
108      configs = ['8888', 'srgb']
109
110    if 'FSAA' in bot or 'FAAA' in bot or 'FDAA' in bot:
111      # Scan converters shouldn't really be sensitive to different color
112      # configurations.
113      configs = ['8888', 'tiles_rt-8888']
114
115    if 'NativeFonts' in bot:
116      configs = ['8888']
117
118    # Just do the basic config on Chromecast to avoid OOM.
119    if 'Chromecast' in bot:
120      configs = ['8888']
121
122  elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU':
123    args.append('--nocpu')
124
125    # Add in either gles or gl configs to the canonical set based on OS
126    sample_count = '8'
127    gl_prefix = 'gl'
128    if 'Android' in bot or 'iOS' in bot:
129      sample_count = '4'
130      # We want to test the OpenGL config not the GLES config on the Shield
131      if 'NVIDIA_Shield' not in bot:
132        gl_prefix = 'gles'
133    elif 'Intel' in bot:
134      sample_count = ''
135    elif 'ChromeOS' in bot:
136      gl_prefix = 'gles'
137
138    if 'NativeFonts' in bot:
139      configs.append(gl_prefix)
140    else:
141      configs.extend([gl_prefix, gl_prefix + 'dft', gl_prefix + 'srgb'])
142      if sample_count is not '':
143        configs.append(gl_prefix + 'msaa' + sample_count)
144
145    # The NP produces a long error stream when we run with MSAA. The Tegra3 just
146    # doesn't support it.
147    if ('NexusPlayer' in bot or
148        'Tegra3'      in bot or
149        # We aren't interested in fixing msaa bugs on current iOS devices.
150        'iPad4' in bot or
151        'iPadPro' in bot or
152        'iPhone6' in bot or
153        'iPhone7' in bot or
154        # skia:5792
155        'IntelHD530'   in bot or
156        'IntelIris540' in bot):
157      configs = [x for x in configs if 'msaa' not in x]
158
159    # The NP produces different images for dft on every run.
160    if 'NexusPlayer' in bot:
161      configs = [x for x in configs if 'dft' not in x]
162
163    # We want to test both the OpenGL config and the GLES config on Linux Intel:
164    # GL is used by Chrome, GLES is used by ChromeOS.
165    # Also do the Ganesh threading verification test (render with and without
166    # worker threads, using only the SW path renderer, and compare the results).
167    if 'Intel' in bot and api.vars.is_linux:
168      configs.extend(['gles', 'glesdft', 'glessrgb', 'gltestthreading'])
169      # skbug.com/6333, skbug.com/6419, skbug.com/6702
170      blacklist('gltestthreading gm _ lcdblendmodes')
171      blacklist('gltestthreading gm _ lcdoverlap')
172      blacklist('gltestthreading gm _ textbloblooper')
173      # All of these GMs are flaky, too:
174      blacklist('gltestthreading gm _ bleed_alpha_bmp')
175      blacklist('gltestthreading gm _ bleed_alpha_bmp_shader')
176      blacklist('gltestthreading gm _ bleed_alpha_image')
177      blacklist('gltestthreading gm _ bleed_alpha_image_shader')
178      blacklist('gltestthreading gm _ savelayer_with_backdrop')
179      blacklist('gltestthreading gm _ persp_shaders_bw')
180      blacklist('gltestthreading gm _ dftext_blob_persp')
181
182    # The following devices do not support glessrgb.
183    if 'glessrgb' in configs:
184      if ('IntelHD405'    in bot or
185          'IntelIris640'  in bot or
186          'IntelBayTrail' in bot or
187          'IntelHD2000'   in bot or
188          'AndroidOne'    in bot or
189          'Nexus7'        in bot or
190          'NexusPlayer'   in bot):
191        configs.remove('glessrgb')
192
193    # Test SkColorSpaceXformCanvas on a few bots
194    if 'GTX1070' in bot:
195      configs.append('gbr-gl')
196
197    # CommandBuffer bot *only* runs the command_buffer config.
198    if 'CommandBuffer' in bot:
199      configs = ['commandbuffer']
200
201    # ANGLE bot *only* runs the angle configs
202    if 'ANGLE' in bot:
203      configs = ['angle_d3d11_es2',
204                 'angle_d3d9_es2',
205                 'angle_gl_es2',
206                 'angle_d3d11_es3']
207      if sample_count is not '':
208        configs.append('angle_d3d11_es2_msaa' + sample_count)
209        configs.append('angle_d3d11_es3_msaa' + sample_count)
210
211    # Vulkan bot *only* runs the vk config.
212    if 'Vulkan' in bot:
213      configs = ['vk']
214
215    # Test 1010102 on our Linux/NVIDIA bots
216    if 'QuadroP400' in bot and api.vars.is_linux:
217      if 'Vulkan' in bot:
218        configs.append('vk1010102')
219        # Decoding transparent images to 1010102 just looks bad
220        blacklist('vk1010102 image _ _')
221      else:
222        configs.append('gl1010102')
223        # Decoding transparent images to 1010102 just looks bad
224        blacklist('gl1010102 image _ _')
225
226    if 'ChromeOS' in bot:
227      # Just run GLES for now - maybe add gles_msaa4 in the future
228      configs = ['gles']
229
230    if 'Chromecast' in bot:
231      configs = ['gles']
232
233    # Test coverage counting path renderer.
234    if 'CCPR' in bot:
235      configs = [c for c in configs if c == 'gl' or c == 'gles']
236      args.extend(['--pr', 'ccpr', '--cachePathMasks', 'false'])
237
238  tf = api.vars.builder_cfg.get('test_filter')
239  if 'All' != tf:
240    # Expected format: shard_XX_YY
241    parts = tf.split('_')
242    if len(parts) == 3:
243      args.extend(['--shard', parts[1]])
244      args.extend(['--shards', parts[2]])
245    else:
246      raise Exception('Invalid task name - bad shards') #pragma: nocover
247
248  args.append('--config')
249  args.extend(configs)
250
251  # Run tests, gms, and image decoding tests everywhere.
252  args.extend('--src tests gm image colorImage svg'.split(' '))
253  if api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU':
254    # Don't run the 'svgparse_*' svgs on GPU.
255    blacklist('_ svg _ svgparse_')
256  elif bot == 'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN':
257    # Only run the CPU SVGs on 8888.
258    blacklist('~8888 svg _ _')
259  else:
260    # On CPU SVGs we only care about parsing. Only run them on the above bot.
261    args.remove('svg')
262
263  # Eventually I'd like these to pass, but for now just skip 'em.
264  if 'SK_FORCE_RASTER_PIPELINE_BLITTER' in bot:
265    args.remove('tests')
266
267  if 'NativeFonts' in bot:  # images won't exercise native font integration :)
268    args.remove('image')
269    args.remove('colorImage')
270
271  # TODO: ???
272  blacklist('f16 _ _ dstreadshuffle')
273  blacklist('glsrgb image _ _')
274  blacklist('glessrgb image _ _')
275
276  # Not any point to running these.
277  blacklist('gbr-8888 image _ _')
278  blacklist('gbr-8888 colorImage _ _')
279
280  # --src image --config g8 means "decode into Gray8", which isn't supported.
281  blacklist('g8 image _ _')
282  blacklist('g8 colorImage _ _')
283
284  if 'Valgrind' in bot:
285    # These take 18+ hours to run.
286    blacklist('pdf gm _ fontmgr_iter')
287    blacklist('pdf _ _ PANO_20121023_214540.jpg')
288    blacklist('pdf skp _ worldjournal')
289    blacklist('pdf skp _ desk_baidu.skp')
290    blacklist('pdf skp _ desk_wikipedia.skp')
291    blacklist('_ svg _ _')
292
293  if 'iOS' in bot:
294    blacklist(gl_prefix + ' skp _ _')
295
296  if 'Mac' in bot or 'iOS' in bot:
297    # CG fails on questionable bmps
298    blacklist('_ image gen_platf rgba32abf.bmp')
299    blacklist('_ image gen_platf rgb24prof.bmp')
300    blacklist('_ image gen_platf rgb24lprof.bmp')
301    blacklist('_ image gen_platf 8bpp-pixeldata-cropped.bmp')
302    blacklist('_ image gen_platf 4bpp-pixeldata-cropped.bmp')
303    blacklist('_ image gen_platf 32bpp-pixeldata-cropped.bmp')
304    blacklist('_ image gen_platf 24bpp-pixeldata-cropped.bmp')
305
306    # CG has unpredictable behavior on this questionable gif
307    # It's probably using uninitialized memory
308    blacklist('_ image gen_platf frame_larger_than_image.gif')
309
310    # CG has unpredictable behavior on incomplete pngs
311    # skbug.com/5774
312    blacklist('_ image gen_platf inc0.png')
313    blacklist('_ image gen_platf inc1.png')
314    blacklist('_ image gen_platf inc2.png')
315    blacklist('_ image gen_platf inc3.png')
316    blacklist('_ image gen_platf inc4.png')
317    blacklist('_ image gen_platf inc5.png')
318    blacklist('_ image gen_platf inc6.png')
319    blacklist('_ image gen_platf inc7.png')
320    blacklist('_ image gen_platf inc8.png')
321    blacklist('_ image gen_platf inc9.png')
322    blacklist('_ image gen_platf inc10.png')
323    blacklist('_ image gen_platf inc11.png')
324    blacklist('_ image gen_platf inc12.png')
325    blacklist('_ image gen_platf inc13.png')
326    blacklist('_ image gen_platf inc14.png')
327
328    # These images fail after Mac 10.13.1 upgrade.
329    blacklist('_ image gen_platf incInterlaced.gif')
330    blacklist('_ image gen_platf inc1.gif')
331    blacklist('_ image gen_platf inc0.gif')
332    blacklist('_ image gen_platf butterfly.gif')
333
334  # WIC fails on questionable bmps
335  if 'Win' in bot:
336    blacklist('_ image gen_platf pal8os2v2.bmp')
337    blacklist('_ image gen_platf pal8os2v2-16.bmp')
338    blacklist('_ image gen_platf rgba32abf.bmp')
339    blacklist('_ image gen_platf rgb24prof.bmp')
340    blacklist('_ image gen_platf rgb24lprof.bmp')
341    blacklist('_ image gen_platf 8bpp-pixeldata-cropped.bmp')
342    blacklist('_ image gen_platf 4bpp-pixeldata-cropped.bmp')
343    blacklist('_ image gen_platf 32bpp-pixeldata-cropped.bmp')
344    blacklist('_ image gen_platf 24bpp-pixeldata-cropped.bmp')
345    if 'x86_64' in bot and 'CPU' in bot:
346      # This GM triggers a SkSmallAllocator assert.
347      blacklist('_ gm _ composeshader_bitmap')
348
349  if 'Win' in bot or 'Mac' in bot:
350    # WIC and CG fail on arithmetic jpegs
351    blacklist('_ image gen_platf testimgari.jpg')
352    # More questionable bmps that fail on Mac, too. skbug.com/6984
353    blacklist('_ image gen_platf rle8-height-negative.bmp')
354    blacklist('_ image gen_platf rle4-height-negative.bmp')
355
356  if 'Android' in bot or 'iOS' in bot or 'Chromecast' in bot:
357    # This test crashes the N9 (perhaps because of large malloc/frees). It also
358    # is fairly slow and not platform-specific. So we just disable it on all of
359    # Android and iOS. skia:5438
360    blacklist('_ test _ GrShape')
361
362  if api.vars.internal_hardware_label == 1:
363    # skia:7046
364    blacklist('_ test _ WritePixelsNonTexture_Gpu')
365    blacklist('_ test _ WritePixelsNonTextureMSAA_Gpu')
366    blacklist('_ test _ WritePixels_Gpu')
367    blacklist('_ test _ WritePixelsMSAA_Gpu')
368    blacklist('_ test _ GrSurfaceRenderability')
369    blacklist('_ test _ ES2BlendWithNoTexture')
370
371  if api.vars.internal_hardware_label == 2:
372    # skia:7160
373    blacklist('_ test _ SRGBReadWritePixels')
374    blacklist('_ test _ SRGBMipMap')
375
376
377  # skia:4095
378  bad_serialize_gms = ['bleed_image',
379                       'c_gms',
380                       'colortype',
381                       'colortype_xfermodes',
382                       'drawfilter',
383                       'fontmgr_bounds_0.75_0',
384                       'fontmgr_bounds_1_-0.25',
385                       'fontmgr_bounds',
386                       'fontmgr_match',
387                       'fontmgr_iter',
388                       'imagemasksubset']
389
390  # skia:5589
391  bad_serialize_gms.extend(['bitmapfilters',
392                            'bitmapshaders',
393                            'bleed',
394                            'bleed_alpha_bmp',
395                            'bleed_alpha_bmp_shader',
396                            'convex_poly_clip',
397                            'extractalpha',
398                            'filterbitmap_checkerboard_32_32_g8',
399                            'filterbitmap_image_mandrill_64',
400                            'shadows',
401                            'simpleaaclip_aaclip'])
402  # skia:5595
403  bad_serialize_gms.extend(['composeshader_bitmap',
404                            'scaled_tilemodes_npot',
405                            'scaled_tilemodes'])
406
407  # skia:5778
408  bad_serialize_gms.append('typefacerendering_pfaMac')
409  # skia:5942
410  bad_serialize_gms.append('parsedpaths')
411
412  # these use a custom image generator which doesn't serialize
413  bad_serialize_gms.append('ImageGeneratorExternal_rect')
414  bad_serialize_gms.append('ImageGeneratorExternal_shader')
415
416  # skia:6189
417  bad_serialize_gms.append('shadow_utils')
418
419  # Not expected to round trip encoding/decoding.
420  bad_serialize_gms.append('all_bitmap_configs')
421  bad_serialize_gms.append('makecolorspace')
422
423  # This GM forces a path to be convex. That property doesn't survive
424  # serialization.
425  bad_serialize_gms.append('analytic_antialias_convex')
426
427  for test in bad_serialize_gms:
428    blacklist(['serialize-8888', 'gm', '_', test])
429
430  if 'Mac' not in bot:
431    for test in ['bleed_alpha_image', 'bleed_alpha_image_shader']:
432      blacklist(['serialize-8888', 'gm', '_', test])
433  # It looks like we skip these only for out-of-memory concerns.
434  if 'Win' in bot or 'Android' in bot:
435    for test in ['verylargebitmap', 'verylarge_picture_image']:
436      blacklist(['serialize-8888', 'gm', '_', test])
437  if 'Mac' in bot and 'CPU' in bot:
438    # skia:6992
439    blacklist(['pic-8888', 'gm', '_', 'encode-platform'])
440    blacklist(['serialize-8888', 'gm', '_', 'encode-platform'])
441
442  # skia:4769
443  for test in ['drawfilter']:
444    blacklist([   'pic-8888', 'gm', '_', test])
445    blacklist([  'lite-8888', 'gm', '_', test])
446  # skia:4703
447  for test in ['image-cacherator-from-picture',
448               'image-cacherator-from-raster',
449               'image-cacherator-from-ctable']:
450    blacklist([      'pic-8888', 'gm', '_', test])
451    blacklist(['serialize-8888', 'gm', '_', test])
452
453  # GM that requires raster-backed canvas
454  for test in ['gamut', 'complexclip4_bw', 'complexclip4_aa']:
455    blacklist([      'pic-8888', 'gm', '_', test])
456    blacklist([     'lite-8888', 'gm', '_', test])
457    blacklist(['serialize-8888', 'gm', '_', test])
458
459  # GM that not support tiles_rt
460  for test in ['complexclip4_bw', 'complexclip4_aa']:
461    blacklist([ 'tiles_rt-8888', 'gm', '_', test])
462
463  # Extensions for RAW images
464  r = ['arw', 'cr2', 'dng', 'nef', 'nrw', 'orf', 'raf', 'rw2', 'pef', 'srw',
465       'ARW', 'CR2', 'DNG', 'NEF', 'NRW', 'ORF', 'RAF', 'RW2', 'PEF', 'SRW']
466
467  # skbug.com/4888
468  # Blacklist RAW images (and a few large PNGs) on GPU bots
469  # until we can resolve failures.
470  if 'GPU' in bot:
471    blacklist('_ image _ interlaced1.png')
472    blacklist('_ image _ interlaced2.png')
473    blacklist('_ image _ interlaced3.png')
474    for raw_ext in r:
475      blacklist('_ image _ .%s' % raw_ext)
476
477  # Blacklist memory intensive tests on 32-bit bots.
478  if ('Win8' in bot or 'Win2016' in bot) and 'x86-' in bot:
479    blacklist('_ image f16 _')
480    blacklist('_ image _ abnormal.wbmp')
481    blacklist('_ image _ interlaced1.png')
482    blacklist('_ image _ interlaced2.png')
483    blacklist('_ image _ interlaced3.png')
484    for raw_ext in r:
485      blacklist('_ image _ .%s' % raw_ext)
486
487  if 'IntelHD405' in bot and 'Ubuntu16' in bot:
488    # skia:6331
489    blacklist(['glmsaa8',   'image', 'gen_codec_gpu', 'abnormal.wbmp'])
490    blacklist(['glesmsaa4', 'image', 'gen_codec_gpu', 'abnormal.wbmp'])
491
492  if 'Nexus5' in bot and 'GPU' in bot:
493    # skia:5876
494    blacklist(['_', 'gm', '_', 'encode-platform'])
495
496  if 'AndroidOne-GPU' in bot:  # skia:4697, skia:4704, skia:4694, skia:4705
497    blacklist(['_',            'gm', '_', 'bigblurs'])
498    blacklist(['_',            'gm', '_', 'bleed'])
499    blacklist(['_',            'gm', '_', 'bleed_alpha_bmp'])
500    blacklist(['_',            'gm', '_', 'bleed_alpha_bmp_shader'])
501    blacklist(['_',            'gm', '_', 'bleed_alpha_image'])
502    blacklist(['_',            'gm', '_', 'bleed_alpha_image_shader'])
503    blacklist(['_',            'gm', '_', 'bleed_image'])
504    blacklist(['_',            'gm', '_', 'dropshadowimagefilter'])
505    blacklist(['_',            'gm', '_', 'filterfastbounds'])
506    blacklist([gl_prefix,      'gm', '_', 'imageblurtiled'])
507    blacklist(['_',            'gm', '_', 'imagefiltersclipped'])
508    blacklist(['_',            'gm', '_', 'imagefiltersscaled'])
509    blacklist(['_',            'gm', '_', 'imageresizetiled'])
510    blacklist(['_',            'gm', '_', 'matrixconvolution'])
511    blacklist(['_',            'gm', '_', 'strokedlines'])
512    if sample_count is not '':
513      gl_msaa_config = gl_prefix + 'msaa' + sample_count
514      blacklist([gl_msaa_config, 'gm', '_', 'imageblurtiled'])
515      blacklist([gl_msaa_config, 'gm', '_', 'imagefiltersbase'])
516
517  match = []
518  if 'Valgrind' in bot: # skia:3021
519    match.append('~Threaded')
520
521  if 'Valgrind' in bot and 'PreAbandonGpuContext' in bot:
522    # skia:6575
523    match.append('~multipicturedraw_')
524
525  if 'CommandBuffer' in bot:
526    # https://crbug.com/697030
527    match.append('~HalfFloatAlphaTextureTest')
528
529  if 'AndroidOne' in bot:
530    match.append('~WritePixels')  # skia:4711
531    match.append('~PremulAlphaRoundTrip_Gpu')  # skia:7501
532
533  if 'Chromecast' in bot:
534    if 'GPU' in bot:
535      # skia:6687
536      match.append('~animated-image-blurs')
537      match.append('~blur_0.01')
538      match.append('~blur_image_filter')
539      match.append('~imageblur2')
540      match.append('~lighting')
541      match.append('~longpathdash')
542      match.append('~matrixconvolution')
543      match.append('~textblobmixedsizes_df')
544      match.append('~textblobrandomfont')
545    # Blacklisted to avoid OOM (we see DM just end with "broken pipe")
546    match.append('~bigbitmaprect_')
547    match.append('~DrawBitmapRect')
548    match.append('~drawbitmaprect')
549    match.append('~GM_animated-image-blurs')
550    match.append('~ImageFilterBlurLargeImage')
551    match.append('~savelayer_clipmask')
552    match.append('~TextBlobCache')
553    match.append('~verylarge')
554
555  if 'GalaxyS6' in bot:
556    match.append('~SpecialImage') # skia:6338
557    match.append('~skbug6653') # skia:6653
558
559  if 'GalaxyS7_G930A' in bot:
560    match.append('~WritePixels') # skia:6427
561
562  if 'MSAN' in bot:
563    match.extend(['~Once', '~Shared'])  # Not sure what's up with these tests.
564
565  if 'TSAN' in bot:
566    match.extend(['~ReadWriteAlpha'])   # Flaky on TSAN-covered on nvidia bots.
567    match.extend(['~RGBA4444TextureTest',  # Flakier than they are important.
568                  '~RGB565TextureTest'])
569
570  # By default, we test with GPU threading enabled, unless specifically
571  # disabled.
572  if 'NoGPUThreads' in bot:
573    args.extend(['--gpuThreads', '0'])
574
575  if 'Vulkan' in bot and 'Adreno530' in bot:
576      # skia:5777
577      match.extend(['~CopySurface'])
578
579  if 'Vulkan' in bot and 'Adreno' in bot:
580      # skia:7663
581      match.extend(['~WritePixelsNonTextureMSAA_Gpu'])
582      match.extend(['~WritePixelsMSAA_Gpu'])
583
584  if 'Vulkan' in bot and 'NexusPlayer' in bot:
585    # skia:6132
586    match.append('~^tilemodes$')
587    match.append('~tilemodes_npot$')
588    match.append('~scaled_tilemodes$')
589    match.append('~emboss')
590    match.append('~^bitmapfilters$')
591    match.append('~^shadertext$')
592    match.append('~^FullScreenClearWithLayers$') #skia:7191
593    match.append('~^GrDefaultPathRendererTest$') #skia:7244
594    match.append('~^GrMSAAPathRendererTest$') #skia:7244
595    # skia:7018
596    match.extend(['~^ClearOp$',
597                  '~^ComposedImageFilterBounds_Gpu$',
598                  '~^ImageEncode_Gpu$',
599                  '~^ImageFilterFailAffectsTransparentBlack_Gpu$',
600                  '~^ImageFilterZeroBlurSigma_Gpu$',
601                  '~^ImageNewShader_GPU$',
602                  '~^ImageReadPixels_Gpu$',
603                  '~^ImageScalePixels_Gpu$',
604                  '~^ReadWriteAlpha$',
605                  '~^SpecialImage_DeferredGpu$',
606                  '~^SpecialImage_Gpu$',
607                  '~^SurfaceSemaphores$'])
608
609  if 'Vulkan' in bot and api.vars.is_linux and 'IntelIris640' in bot:
610    match.extend(['~VkHeapTests']) # skia:6245
611
612  if 'Vulkan' in bot and api.vars.is_linux and 'IntelHD405' in bot:
613    # skia:7322
614    blacklist(['vk', 'gm', '_', 'skbug_257'])
615    match.append('~^ClearOp$')
616    match.append('~^CopySurface$')
617    match.append('~^ImageNewShader_GPU$')
618    match.append('~^InitialTextureClear$')
619    match.append('~^PinnedImageTest$')
620    match.append('~^ReadPixels_Gpu$')
621    match.append('~^ReadPixels_Texture$')
622    match.append('~^SRGBReadWritePixels$')
623    match.append('~^VkUploadPixelsTests$')
624    match.append('~^WritePixelsNonTexture_Gpu$')
625    match.append('~^WritePixelsNonTextureMSAA_Gpu$')
626    match.append('~^WritePixels_Gpu$')
627    match.append('~^WritePixelsMSAA_Gpu$')
628    match.append('~^skbug6653$')
629
630  if 'Vulkan' in bot and 'IntelIris540' in bot and 'Win' in bot:
631    # skia:6398
632    blacklist(['vk', 'gm', '_', 'aarectmodes'])
633    blacklist(['vk', 'gm', '_', 'aaxfermodes'])
634    blacklist(['vk', 'gm', '_', 'arithmode'])
635    blacklist(['vk', 'gm', '_', 'composeshader'])
636    blacklist(['vk', 'gm', '_', 'composeshader_alpha'])
637    blacklist(['vk', 'gm', '_', 'composeshader_bitmap'])
638    blacklist(['vk', 'gm', '_', 'composeshader_bitmap2'])
639    blacklist(['vk', 'gm', '_', 'dont_clip_to_layer'])
640    blacklist(['vk', 'gm', '_', 'dftext'])
641    blacklist(['vk', 'gm', '_', 'drawregionmodes'])
642    blacklist(['vk', 'gm', '_', 'filterfastbounds'])
643    blacklist(['vk', 'gm', '_', 'fontcache'])
644    blacklist(['vk', 'gm', '_', 'fontmgr_iter'])
645    blacklist(['vk', 'gm', '_', 'fontmgr_iter_factory'])
646    blacklist(['vk', 'gm', '_', 'fontmgr_match'])
647    blacklist(['vk', 'gm', '_', 'fontscaler'])
648    blacklist(['vk', 'gm', '_', 'fontscalerdistortable'])
649    blacklist(['vk', 'gm', '_', 'gammagradienttext'])
650    blacklist(['vk', 'gm', '_', 'gammatext'])
651    blacklist(['vk', 'gm', '_', 'gradtext'])
652    blacklist(['vk', 'gm', '_', 'hairmodes'])
653    blacklist(['vk', 'gm', '_', 'imagefilters_xfermodes'])
654    blacklist(['vk', 'gm', '_', 'imagefiltersclipped'])
655    blacklist(['vk', 'gm', '_', 'imagefiltersgraph'])
656    blacklist(['vk', 'gm', '_', 'imagefiltersscaled'])
657    blacklist(['vk', 'gm', '_', 'imagefiltersstroked'])
658    blacklist(['vk', 'gm', '_', 'imagefilterstransformed'])
659    blacklist(['vk', 'gm', '_', 'imageresizetiled'])
660    blacklist(['vk', 'gm', '_', 'lcdblendmodes'])
661    blacklist(['vk', 'gm', '_', 'lcdoverlap'])
662    blacklist(['vk', 'gm', '_', 'lcdtext'])
663    blacklist(['vk', 'gm', '_', 'lcdtextsize'])
664    blacklist(['vk', 'gm', '_', 'matriximagefilter'])
665    blacklist(['vk', 'gm', '_', 'mixedtextblobs'])
666    blacklist(['vk', 'gm', '_', 'mixershader'])
667    blacklist(['vk', 'gm', '_', 'pictureimagefilter'])
668    blacklist(['vk', 'gm', '_', 'resizeimagefilter'])
669    blacklist(['vk', 'gm', '_', 'rotate_imagefilter'])
670    blacklist(['vk', 'gm', '_', 'savelayer_lcdtext'])
671    blacklist(['vk', 'gm', '_', 'shadermaskfilter_image'])
672    blacklist(['vk', 'gm', '_', 'srcmode'])
673    blacklist(['vk', 'gm', '_', 'surfaceprops'])
674    blacklist(['vk', 'gm', '_', 'textblobgeometrychange'])
675    blacklist(['vk', 'gm', '_', 'textbloblooper'])
676    blacklist(['vk', 'gm', '_', 'textblobmixedsizes'])
677    blacklist(['vk', 'gm', '_', 'textblobmixedsizes_df'])
678    blacklist(['vk', 'gm', '_', 'textblobrandomfont'])
679    blacklist(['vk', 'gm', '_', 'textfilter_color'])
680    blacklist(['vk', 'gm', '_', 'textfilter_image'])
681    blacklist(['vk', 'gm', '_', 'typefacerendering'])
682    blacklist(['vk', 'gm', '_', 'varied_text_clipped_lcd'])
683    blacklist(['vk', 'gm', '_', 'varied_text_ignorable_clip_lcd'])
684    blacklist(['vk', 'gm', '_', 'xfermodeimagefilter'])
685    match.append('~ApplyGamma')
686    match.append('~ComposedImageFilterBounds_Gpu')
687    match.append('~GrMeshTest')
688    match.append('~ImageFilterFailAffectsTransparentBlack_Gpu')
689    match.append('~ImageFilterZeroBlurSigma_Gpu')
690    match.append('~ImageNewShader_GPU')
691    match.append('~NewTextureFromPixmap')
692    match.append('~ReadPixels_Gpu')
693    match.append('~ReadPixels_Texture')
694    match.append('~ReadWriteAlpha')
695    match.append('~skbug6653')
696    match.append('~SRGBReadWritePixels')
697    match.append('~SpecialImage_DeferredGpu')
698    match.append('~SpecialImage_Gpu')
699    match.append('~WritePixels_Gpu')
700    match.append('~WritePixelsMSAA_Gpu')
701    match.append('~WritePixelsNonTexture_Gpu')
702    match.append('~WritePixelsNonTextureMSAA_Gpu')
703    match.append('~XfermodeImageFilterCroppedInput_Gpu')
704    match.append('~GrDefaultPathRendererTest') #skia:7244
705    match.append('~GrMSAAPathRendererTest') #skia:7244
706    match.append('~SkImage_makeNonTextureImage')
707
708  if (('RadeonR9M470X' in bot or 'RadeonHD7770' in bot) and 'ANGLE' in bot):
709    # skia:7096
710    match.append('~PinnedImageTest')
711
712  if 'IntelIris540' in bot and 'ANGLE' in bot:
713    for config in ['angle_d3d9_es2', 'angle_d3d11_es2', 'angle_gl_es2']:
714      # skia:6103
715      blacklist([config, 'gm', '_', 'multipicturedraw_invpathclip_simple'])
716      blacklist([config, 'gm', '_', 'multipicturedraw_noclip_simple'])
717      blacklist([config, 'gm', '_', 'multipicturedraw_pathclip_simple'])
718      blacklist([config, 'gm', '_', 'multipicturedraw_rectclip_simple'])
719      blacklist([config, 'gm', '_', 'multipicturedraw_rrectclip_simple'])
720      # skia:6141
721      blacklist([config, 'gm', '_', 'discard'])
722
723  if ('IntelIris6100' in bot or 'IntelHD4400' in bot) and 'ANGLE' in bot:
724    # skia:6857
725    blacklist(['angle_d3d9_es2', 'gm', '_', 'lighting'])
726
727  if 'PowerVRGX6250' in bot:
728    match.append('~gradients_view_perspective_nodither') #skia:6972
729
730  if '-arm-' in bot and 'ASAN' in bot:
731    # TODO: can we run with env allocator_may_return_null=1 instead?
732    match.append('~BadImage')
733
734  if 'Mac' in bot and 'IntelHD6000' in bot:
735    # skia:7574
736    match.append('~^ProcessorCloneTest$')
737    match.append('~^GrMeshTest$')
738
739  if 'Mac' in bot and 'IntelHD615' in bot:
740    # skia:7603
741    match.append('~^GrMeshTest$')
742
743  if blacklisted:
744    args.append('--blacklist')
745    args.extend(blacklisted)
746
747  if match:
748    args.append('--match')
749    args.extend(match)
750
751  # These bots run out of memory running RAW codec tests. Do not run them in
752  # parallel
753  if 'NexusPlayer' in bot or 'Nexus5' in bot or 'Nexus9' in bot:
754    args.append('--noRAW_threading')
755
756  if 'FSAA' in bot:
757    args.extend(['--analyticAA', 'false', '--deltaAA', 'false'])
758  if 'FAAA' in bot:
759    args.extend(['--deltaAA', 'false', '--forceAnalyticAA'])
760  if 'FDAA' in bot:
761    args.extend(['--deltaAA', '--forceDeltaAA'])
762
763  if 'NativeFonts' not in bot:
764    args.append('--nonativeFonts')
765
766  if 'GDI' in bot:
767    args.append('--gdi')
768
769  # Let's make all bots produce verbose output by default.
770  args.append('--verbose')
771
772  return args
773
774
775def key_params(api):
776  """Build a unique key from the builder name (as a list).
777
778  E.g.  arch x86 gpu GeForce320M mode MacMini4.1 os Mac10.6
779  """
780  # Don't bother to include role, which is always Test.
781  blacklist = ['role', 'test_filter']
782
783  flat = []
784  for k in sorted(api.vars.builder_cfg.keys()):
785    if k not in blacklist:
786      flat.append(k)
787      flat.append(api.vars.builder_cfg[k])
788  return flat
789
790
791def test_steps(api):
792  """Run the DM test."""
793  use_hash_file = False
794  if api.vars.upload_dm_results:
795    host_dm_dir = str(api.vars.dm_dir)
796    device_dm_dir = str(api.flavor.device_dirs.dm_dir)
797    if host_dm_dir != device_dm_dir:
798      api.flavor.create_clean_device_dir(device_dm_dir)
799
800    # Obtain the list of already-generated hashes.
801    hash_filename = 'uninteresting_hashes.txt'
802
803    # Ensure that the tmp_dir exists.
804    api.run.run_once(api.file.ensure_directory,
805                     'makedirs tmp_dir',
806                     api.vars.tmp_dir)
807
808    host_hashes_file = api.vars.tmp_dir.join(hash_filename)
809    hashes_file = api.flavor.device_path_join(
810        api.flavor.device_dirs.tmp_dir, hash_filename)
811    api.run(
812        api.python.inline,
813        'get uninteresting hashes',
814        program="""
815        import contextlib
816        import math
817        import socket
818        import sys
819        import time
820        import urllib2
821
822        HASHES_URL = 'https://storage.googleapis.com/skia-infra-gm/hash_files/gold-prod-hashes.txt'
823        RETRIES = 5
824        TIMEOUT = 60
825        WAIT_BASE = 15
826
827        socket.setdefaulttimeout(TIMEOUT)
828        for retry in range(RETRIES):
829          try:
830            with contextlib.closing(
831                urllib2.urlopen(HASHES_URL, timeout=TIMEOUT)) as w:
832              hashes = w.read()
833              with open(sys.argv[1], 'w') as f:
834                f.write(hashes)
835                break
836          except Exception as e:
837            print 'Failed to get uninteresting hashes from %s:' % HASHES_URL
838            print e
839            if retry == RETRIES:
840              raise
841            waittime = WAIT_BASE * math.pow(2, retry)
842            print 'Retry in %d seconds.' % waittime
843            time.sleep(waittime)
844        """,
845        args=[host_hashes_file],
846        abort_on_failure=False,
847        fail_build_on_failure=False,
848        infra_step=True)
849
850    if api.path.exists(host_hashes_file):
851      api.flavor.copy_file_to_device(host_hashes_file, hashes_file)
852      use_hash_file = True
853
854  # Run DM.
855  properties = [
856    'gitHash',              api.vars.got_revision,
857    'builder',              api.vars.builder_name,
858    'buildbucket_build_id', api.properties.get('buildbucket_build_id', ''),
859  ]
860  if api.vars.is_trybot:
861    properties.extend([
862      'issue',         api.vars.issue,
863      'patchset',      api.vars.patchset,
864      'patch_storage', api.vars.patch_storage,
865    ])
866  properties.extend(['swarming_bot_id', api.vars.swarming_bot_id])
867  properties.extend(['swarming_task_id', api.vars.swarming_task_id])
868
869  if 'Chromecast' in api.vars.builder_cfg.get('os', ''):
870    # Due to limited disk space, we only deal with skps and one image.
871    args = [
872      'dm',
873      '--resourcePath', api.flavor.device_dirs.resource_dir,
874      '--skps', api.flavor.device_dirs.skp_dir,
875      '--images', api.flavor.device_path_join(
876          api.flavor.device_dirs.resource_dir, 'images', 'color_wheel.jpg'),
877      '--nameByHash',
878      '--properties'
879    ] + properties
880  else:
881    args = [
882      'dm',
883      '--resourcePath', api.flavor.device_dirs.resource_dir,
884      '--skps', api.flavor.device_dirs.skp_dir,
885      '--images', api.flavor.device_path_join(
886          api.flavor.device_dirs.images_dir, 'dm'),
887      '--colorImages', api.flavor.device_path_join(
888          api.flavor.device_dirs.images_dir, 'colorspace'),
889      '--nameByHash',
890      '--properties'
891    ] + properties
892
893    args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
894
895  args.append('--key')
896  args.extend(key_params(api))
897
898  if use_hash_file:
899    args.extend(['--uninterestingHashesFile', hashes_file])
900  if api.vars.upload_dm_results:
901    args.extend(['--writePath', api.flavor.device_dirs.dm_dir])
902
903  args.extend(dm_flags(api, api.vars.builder_name))
904
905  # See skia:2789.
906  if 'AbandonGpuContext' in api.vars.extra_tokens:
907    args.append('--abandonGpuContext')
908  if 'PreAbandonGpuContext' in api.vars.extra_tokens:
909    args.append('--preAbandonGpuContext')
910  if 'ReleaseAndAbandonGpuContext' in api.vars.extra_tokens:
911    args.append('--releaseAndAbandonGpuContext')
912
913  api.run(api.flavor.step, 'dm', cmd=args, abort_on_failure=False)
914
915  if api.vars.upload_dm_results:
916    # Copy images and JSON to host machine if needed.
917    api.flavor.copy_directory_contents_to_host(
918        api.flavor.device_dirs.dm_dir, api.vars.dm_dir)
919
920
921def RunSteps(api):
922  api.core.setup()
923  env = {}
924  if 'iOS' in api.vars.builder_name:
925    env['IOS_BUNDLE_ID'] = 'com.google.dm'
926    env['IOS_MOUNT_POINT'] = api.vars.slave_dir.join('mnt_iosdevice')
927  with api.context(env=env):
928    try:
929      if 'Chromecast' in api.vars.builder_name:
930        api.flavor.install(resources=True, skps=True)
931      else:
932        api.flavor.install_everything()
933      test_steps(api)
934    finally:
935      api.flavor.cleanup_steps()
936    api.run.check_failure()
937
938
939TEST_BUILDERS = [
940  'Test-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android',
941  'Test-Android-Clang-GalaxyS6-GPU-MaliT760-arm64-Debug-All-Android',
942  'Test-Android-Clang-GalaxyS7_G930A-GPU-Adreno530-arm64-Debug-All-Android',
943  'Test-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android',
944  'Test-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_CCPR',
945  'Test-Android-Clang-Nexus5-GPU-Adreno330-arm-Release-All-Android',
946  'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm-Debug-All-Android_ASAN',
947  'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android_ASAN',
948  ('Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All'
949   '-Android_NoGPUThreads'),
950  'Test-Android-Clang-Nexus7-CPU-Tegra3-arm-Release-All-Android',
951  'Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Debug-All-Android',
952  'Test-Android-Clang-NexusPlayer-CPU-Moorefield-x86-Release-All-Android',
953  'Test-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android_Vulkan',
954  'Test-Android-Clang-Pixel-GPU-Adreno530-arm64-Debug-All-Android_CCPR',
955  'Test-Android-Clang-Pixel-GPU-Adreno530-arm64-Debug-All-Android_Vulkan',
956  'Test-ChromeOS-Clang-ASUSChromebookFlipC100-GPU-MaliT764-arm-Debug-All',
957  ('Test-ChromeOS-Clang-AcerChromebookR13Convertible-GPU-PowerVRGX6250-'
958   'arm-Debug-All'),
959  'Test-Chromecast-GCC-Chorizo-CPU-Cortex_A7-arm-Release-All',
960  'Test-Chromecast-GCC-Chorizo-GPU-Cortex_A7-arm-Release-All',
961  'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN',
962  'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage',
963  'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN',
964  ('Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All'
965   '-SK_USE_DISCARDABLE_SCALEDIMAGECACHE'),
966  ('Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All'
967   '-SK_FORCE_RASTER_PIPELINE_BLITTER'),
968  'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN',
969  'Test-Debian9-GCC-GCE-CPU-AVX2-x86-Debug-All',
970  'Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All',
971  'Test-Mac-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Debug-All',
972  'Test-Mac-Clang-MacBookAir7.2-GPU-IntelHD6000-x86_64-Debug-All',
973  'Test-Mac-Clang-MacMini7.1-CPU-AVX-x86_64-Release-All',
974  'Test-Mac-Clang-MacMini7.1-GPU-IntelIris5100-x86_64-Debug-All-CommandBuffer',
975  'Test-Mac-Clang-MacBook10.1-GPU-IntelHD615-x86_64-Release-All-NativeFonts',
976  'Test-Ubuntu16-Clang-NUC5PPYH-GPU-IntelHD405-x86_64-Debug-All',
977  'Test-Ubuntu16-Clang-NUC5PPYH-GPU-IntelHD405-x86_64-Release-All-Vulkan',
978  'Test-Ubuntu16-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-Vulkan',
979  'Test-Ubuntu16-Clang-NUCDE3815TYKHE-GPU-IntelBayTrail-x86_64-Debug-All',
980  'Test-Ubuntu17-Clang-Golo-GPU-QuadroP400-x86_64-Debug-All-Vulkan_Coverage',
981  ('Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All'
982   '-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41'),
983  ('Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All'
984   '-Valgrind_PreAbandonGpuContext_SK_CPU_LIMIT_SSE41'),
985  ('Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All'
986   '-Valgrind_SK_CPU_LIMIT_SSE41'),
987  'Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-ANGLE',
988  'Test-Win10-Clang-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-All-Vulkan',
989  ('Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All'
990   '-ReleaseAndAbandonGpuContext'),
991  'Test-Win10-Clang-NUC5i7RYH-CPU-AVX2-x86_64-Debug-All-NativeFonts',
992  'Test-Win10-Clang-NUC5i7RYH-CPU-AVX2-x86_64-Debug-All-NativeFonts_GDI',
993  'Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-ANGLE',
994  'Test-Win10-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-All-Vulkan',
995  'Test-Win10-Clang-NUCD34010WYKH-GPU-IntelHD4400-x86_64-Release-All-ANGLE',
996  'Test-Win10-Clang-ShuttleA-GPU-GTX660-x86_64-Debug-All-Vulkan',
997  'Test-Win10-Clang-ShuttleC-GPU-GTX960-x86_64-Debug-All-ANGLE',
998  'Test-Win10-Clang-ZBOX-GPU-GTX1070-x86_64-Debug-All',
999  'Test-Win10-Clang-ZBOX-GPU-GTX1070-x86_64-Debug-All-Vulkan',
1000  'Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FAAA',
1001  'Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FDAA',
1002  'Test-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-FSAA',
1003  'Test-Win8-MSVC-Golo-CPU-AVX-x86-Debug-All',
1004  'Test-iOS-Clang-iPadPro-GPU-GT7800-arm64-Release-All',
1005]
1006
1007
1008def GenTests(api):
1009  for builder in TEST_BUILDERS:
1010    test = (
1011      api.test(builder) +
1012      api.properties(buildername=builder,
1013                     buildbucket_build_id='123454321',
1014                     revision='abc123',
1015                     path_config='kitchen',
1016                     swarm_out_dir='[SWARM_OUT_DIR]') +
1017      api.path.exists(
1018          api.path['start_dir'].join('skia'),
1019          api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1020                                     'skimage', 'VERSION'),
1021          api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1022                                     'skp', 'VERSION'),
1023          api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1024                                     'svg', 'VERSION'),
1025          api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1026      ) +
1027      api.step_data('get swarming bot id',
1028          stdout=api.raw_io.output('skia-bot-123')) +
1029      api.step_data('get swarming task id',
1030          stdout=api.raw_io.output('123456'))
1031    )
1032    if 'Win' in builder:
1033      test += api.platform('win', 64)
1034
1035    if 'Chromecast' in builder:
1036      test += api.step_data(
1037          'read chromecast ip',
1038          stdout=api.raw_io.output('192.168.1.2:5555'))
1039
1040    if 'ChromeOS' in builder:
1041      test += api.step_data(
1042          'read chromeos ip',
1043          stdout=api.raw_io.output('{"user_ip":"foo@127.0.0.1"}'))
1044
1045    yield test
1046
1047  builder = 'Test-Win2k8-MSVC-GCE-CPU-AVX2-x86_64-Release-All'
1048  yield (
1049    api.test('trybot') +
1050    api.properties(buildername=builder,
1051                   buildbucket_build_id='123454321',
1052                   revision='abc123',
1053                   path_config='kitchen',
1054                   swarm_out_dir='[SWARM_OUT_DIR]') +
1055    api.properties(patch_storage='gerrit') +
1056    api.properties.tryserver(
1057          buildername=builder,
1058          gerrit_project='skia',
1059          gerrit_url='https://skia-review.googlesource.com/',
1060      )+
1061    api.path.exists(
1062        api.path['start_dir'].join('skia'),
1063        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1064                                     'skimage', 'VERSION'),
1065        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1066                                     'skp', 'VERSION'),
1067        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1068                                     'svg', 'VERSION'),
1069        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1070    )
1071  )
1072
1073  builder = 'Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Debug-All'
1074  yield (
1075    api.test('failed_dm') +
1076    api.properties(buildername=builder,
1077                   buildbucket_build_id='123454321',
1078                   revision='abc123',
1079                   path_config='kitchen',
1080                   swarm_out_dir='[SWARM_OUT_DIR]') +
1081    api.path.exists(
1082        api.path['start_dir'].join('skia'),
1083        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1084                                     'skimage', 'VERSION'),
1085        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1086                                     'skp', 'VERSION'),
1087        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1088                                     'svg', 'VERSION'),
1089        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1090    ) +
1091    api.step_data('symbolized dm', retcode=1)
1092  )
1093
1094  builder = 'Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android'
1095  yield (
1096    api.test('failed_get_hashes') +
1097    api.properties(buildername=builder,
1098                   buildbucket_build_id='123454321',
1099                   revision='abc123',
1100                   path_config='kitchen',
1101                   swarm_out_dir='[SWARM_OUT_DIR]') +
1102    api.path.exists(
1103        api.path['start_dir'].join('skia'),
1104        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1105                                     'skimage', 'VERSION'),
1106        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1107                                     'skp', 'VERSION'),
1108        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1109                                     'svg', 'VERSION'),
1110        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1111    ) +
1112    api.step_data('get uninteresting hashes', retcode=1)
1113  )
1114
1115  builder = ('Test-Android-Clang-NexusPlayer-CPU-Moorefield-x86-'
1116             'Debug-All-Android')
1117  yield (
1118    api.test('failed_push') +
1119    api.properties(buildername=builder,
1120                   buildbucket_build_id='123454321',
1121                   revision='abc123',
1122                   path_config='kitchen',
1123                   swarm_out_dir='[SWARM_OUT_DIR]') +
1124    api.path.exists(
1125        api.path['start_dir'].join('skia'),
1126        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1127                                     'skimage', 'VERSION'),
1128        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1129                                     'skp', 'VERSION'),
1130        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1131                                     'svg', 'VERSION'),
1132        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1133    ) +
1134    api.step_data('get swarming bot id',
1135                  stdout=api.raw_io.output('build123-m2--device5')) +
1136    api.step_data('push [START_DIR]/skia/resources/* '+
1137                  '/sdcard/revenge_of_the_skiabot/resources', retcode=1)
1138  )
1139
1140  builder = 'Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Debug-All-Android'
1141  yield (
1142    api.test('failed_pull') +
1143    api.properties(buildername=builder,
1144                   buildbucket_build_id='123454321',
1145                   revision='abc123',
1146                   path_config='kitchen',
1147                   swarm_out_dir='[SWARM_OUT_DIR]') +
1148    api.path.exists(
1149        api.path['start_dir'].join('skia'),
1150        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1151                                     'skimage', 'VERSION'),
1152        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1153                                     'skp', 'VERSION'),
1154        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1155                                     'svg', 'VERSION'),
1156        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1157    ) +
1158    api.step_data('dm', retcode=1) +
1159    api.step_data('pull /sdcard/revenge_of_the_skiabot/dm_out '+
1160                  '[CUSTOM_[SWARM_OUT_DIR]]/dm', retcode=1)
1161  )
1162
1163  yield (
1164    api.test('internal_bot_1') +
1165    api.properties(buildername=builder,
1166                   buildbucket_build_id='123454321',
1167                   revision='abc123',
1168                   path_config='kitchen',
1169                   swarm_out_dir='[SWARM_OUT_DIR]',
1170                   internal_hardware_label=1) +
1171    api.path.exists(
1172        api.path['start_dir'].join('skia'),
1173        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1174                                     'skimage', 'VERSION'),
1175        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1176                                     'skp', 'VERSION'),
1177        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1178                                     'svg', 'VERSION'),
1179        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1180    )
1181  )
1182
1183  yield (
1184    api.test('internal_bot_2') +
1185    api.properties(buildername=builder,
1186                   buildbucket_build_id='123454321',
1187                   revision='abc123',
1188                   path_config='kitchen',
1189                   swarm_out_dir='[SWARM_OUT_DIR]',
1190                   internal_hardware_label=2) +
1191    api.path.exists(
1192        api.path['start_dir'].join('skia'),
1193        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1194                                     'skimage', 'VERSION'),
1195        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1196                                     'skp', 'VERSION'),
1197        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
1198                                     'svg', 'VERSION'),
1199        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
1200    )
1201  )
1202