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