• 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  '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
30  # This enables non-deterministic random seeding of the GPU FP optimization
31  # test.
32  args.append('--randomProcessorTest')
33
34  # 32-bit desktop bots tend to run out of memory, because they have relatively
35  # far more cores than RAM (e.g. 32 cores, 3G RAM).  Hold them back a bit.
36  if '-x86-' in bot and not 'NexusPlayer' in bot:
37    args.extend(['--threads', '4'])
38
39  # Avoid issues with dynamically exceeding resource cache limits.
40  if 'Test' in bot and 'DISCARDABLE' in bot:
41    args.extend(['--threads', '0'])
42
43  # See if staying on the main thread helps skia:6748.
44  if 'Test-iOS' in bot:
45    args.extend(['--threads', '0'])
46
47  # These are the canonical configs that we would ideally run on all bots. We
48  # may opt out or substitute some below for specific bots
49  configs = ['8888', 'srgb', 'pdf']
50  # Add in either gles or gl configs to the canonical set based on OS
51  sample_count = '8'
52  gl_prefix = 'gl'
53  if 'Android' in bot or 'iOS' in bot:
54    sample_count = '4'
55    # We want to test the OpenGL config not the GLES config on the Shield
56    if 'NVIDIA_Shield' not in bot:
57      gl_prefix = 'gles'
58  elif 'Intel' in bot:
59    sample_count = ''
60  elif 'ChromeOS' in bot:
61    gl_prefix = 'gles'
62
63  configs.extend([gl_prefix, gl_prefix + 'dft', gl_prefix + 'srgb'])
64  if sample_count is not '':
65    configs.append(gl_prefix + 'msaa' + sample_count)
66
67  # The NP produces a long error stream when we run with MSAA. The Tegra3 just
68  # doesn't support it.
69  if ('NexusPlayer' in bot or
70      'Tegra3'      in bot or
71      # We aren't interested in fixing msaa bugs on current iOS devices.
72      'iPad4' in bot or
73      'iPadPro' in bot or
74      'iPhone6' in bot or
75      'iPhone7' in bot or
76      # skia:5792
77      'IntelHD530'   in bot or
78      'IntelIris540' in bot):
79    configs = [x for x in configs if 'msaa' not in x]
80
81  # The NP produces different images for dft on every run.
82  if 'NexusPlayer' in bot:
83    configs = [x for x in configs if 'dft' not in x]
84
85  # Runs out of memory on Android bots.  Everyone else seems fine.
86  if 'Android' in bot:
87    configs.remove('pdf')
88
89  if '-GCE-' in bot:
90    configs.extend(['565'])
91    configs.extend(['f16'])
92    configs.extend(['sp-8888', '2ndpic-8888'])   # Test niche uses of SkPicture.
93    configs.extend(['lite-8888'])                # Experimental display list.
94    configs.extend(['gbr-8888'])
95
96  if '-TSAN' not in bot and sample_count is not '':
97    if ('TegraK1'  in bot or
98        'TegraX1'  in bot or
99        'GTX550Ti' in bot or
100        'GTX660'   in bot or
101        'GT610'    in bot):
102      configs.append(gl_prefix + 'nvprdit' + sample_count)
103
104  # We want to test both the OpenGL config and the GLES config on Linux Intel:
105  # GL is used by Chrome, GLES is used by ChromeOS.
106  if 'Intel' in bot and api.vars.is_linux:
107    configs.extend(['gles', 'glesdft', 'glessrgb'])
108
109  # NP is running out of RAM when we run all these modes.  skia:3255
110  if 'NexusPlayer' not in bot:
111    configs.extend(mode + '-8888' for mode in
112                   ['serialize', 'tiles_rt', 'pic'])
113
114  # Test instanced rendering on a limited number of platforms
115  if 'Nexus6' in bot:
116    configs.append(gl_prefix + 'inst') # inst msaa isn't working yet on Adreno.
117  elif 'NVIDIA_Shield' in bot or 'PixelC' in bot:
118    # Multisampled instanced configs use nvpr so we substitute inst msaa
119    # configs for nvpr msaa configs.
120    old = gl_prefix + 'nvpr'
121    new = gl_prefix + 'inst'
122    configs = [x.replace(old, new) for x in configs]
123    # We also test non-msaa instanced.
124    configs.append(new)
125  elif 'MacMini6.2' in bot and sample_count is not '':
126    configs.extend([gl_prefix + 'inst', gl_prefix + 'inst' + sample_count])
127
128  # CommandBuffer bot *only* runs the command_buffer config.
129  if 'CommandBuffer' in bot:
130    configs = ['commandbuffer']
131
132  # ANGLE bot *only* runs the angle configs
133  if 'ANGLE' in bot:
134    configs = ['angle_d3d11_es2',
135               'angle_d3d9_es2',
136               'angle_gl_es2',
137               'angle_d3d11_es3']
138    if sample_count is not '':
139      configs.append('angle_d3d11_es2_msaa' + sample_count)
140      configs.append('angle_d3d11_es3_msaa' + sample_count)
141
142  # Vulkan bot *only* runs the vk config.
143  if 'Vulkan' in bot:
144    configs = ['vk']
145
146  if 'ChromeOS' in bot:
147    # Just run GLES for now - maybe add gles_msaa4 in the future
148    configs = ['gles']
149
150  if 'Ci20' in bot:
151    # This bot is really slow, cut it down to just 8888.
152    configs = ['8888']
153
154  # This bot only differs from vanilla CPU bots in 8888 config.
155  if 'SK_FORCE_RASTER_PIPELINE_BLITTER' in bot:
156    configs = ['8888', 'srgb']
157
158  args.append('--config')
159  args.extend(configs)
160
161  # Test coverage counting path renderer.
162  if 'CCPR' in bot:
163    args.extend(['--pr', 'ccpr'])
164
165  # Run tests, gms, and image decoding tests everywhere.
166  args.extend('--src tests gm image colorImage svg'.split(' '))
167  if 'Vulkan' in bot and 'NexusPlayer' in bot:
168    args.remove('svg')
169    args.remove('image')
170
171  # Eventually I'd like these to pass, but for now just skip 'em.
172  if 'SK_FORCE_RASTER_PIPELINE_BLITTER' in bot:
173    args.remove('tests')
174
175  # Some people don't like verbose output.
176  verbose = False
177
178  blacklisted = []
179  def blacklist(quad):
180    config, src, options, name = quad.split(' ') if type(quad) is str else quad
181    if config == '_' or config in configs:
182      blacklisted.extend([config, src, options, name])
183
184  # TODO: ???
185  blacklist('f16 _ _ dstreadshuffle')
186  blacklist('glsrgb image _ _')
187  blacklist('glessrgb image _ _')
188
189  # Not any point to running these.
190  blacklist('gbr-8888 image _ _')
191  blacklist('gbr-8888 colorImage _ _')
192
193  if 'Valgrind' in bot:
194    # These take 18+ hours to run.
195    blacklist('pdf gm _ fontmgr_iter')
196    blacklist('pdf _ _ PANO_20121023_214540.jpg')
197    blacklist('pdf skp _ worldjournal')
198    blacklist('pdf skp _ desk_baidu.skp')
199    blacklist('pdf skp _ desk_wikipedia.skp')
200    blacklist('_ svg _ _')
201
202  if 'iOS' in bot:
203    blacklist(gl_prefix + ' skp _ _')
204
205  if 'Mac' in bot or 'iOS' in bot:
206    # CG fails on questionable bmps
207    blacklist('_ image gen_platf rgba32abf.bmp')
208    blacklist('_ image gen_platf rgb24prof.bmp')
209    blacklist('_ image gen_platf rgb24lprof.bmp')
210    blacklist('_ image gen_platf 8bpp-pixeldata-cropped.bmp')
211    blacklist('_ image gen_platf 4bpp-pixeldata-cropped.bmp')
212    blacklist('_ image gen_platf 32bpp-pixeldata-cropped.bmp')
213    blacklist('_ image gen_platf 24bpp-pixeldata-cropped.bmp')
214
215    # CG has unpredictable behavior on this questionable gif
216    # It's probably using uninitialized memory
217    blacklist('_ image gen_platf frame_larger_than_image.gif')
218
219    # CG has unpredictable behavior on incomplete pngs
220    # skbug.com/5774
221    blacklist('_ image gen_platf inc0.png')
222    blacklist('_ image gen_platf inc1.png')
223    blacklist('_ image gen_platf inc2.png')
224    blacklist('_ image gen_platf inc3.png')
225    blacklist('_ image gen_platf inc4.png')
226    blacklist('_ image gen_platf inc5.png')
227    blacklist('_ image gen_platf inc6.png')
228    blacklist('_ image gen_platf inc7.png')
229    blacklist('_ image gen_platf inc8.png')
230    blacklist('_ image gen_platf inc9.png')
231    blacklist('_ image gen_platf inc10.png')
232    blacklist('_ image gen_platf inc11.png')
233    blacklist('_ image gen_platf inc12.png')
234    blacklist('_ image gen_platf inc13.png')
235    blacklist('_ image gen_platf inc14.png')
236
237  # WIC fails on questionable bmps
238  if 'Win' in bot:
239    blacklist('_ image gen_platf rle8-height-negative.bmp')
240    blacklist('_ image gen_platf rle4-height-negative.bmp')
241    blacklist('_ image gen_platf pal8os2v2.bmp')
242    blacklist('_ image gen_platf pal8os2v2-16.bmp')
243    blacklist('_ image gen_platf rgba32abf.bmp')
244    blacklist('_ image gen_platf rgb24prof.bmp')
245    blacklist('_ image gen_platf rgb24lprof.bmp')
246    blacklist('_ image gen_platf 8bpp-pixeldata-cropped.bmp')
247    blacklist('_ image gen_platf 4bpp-pixeldata-cropped.bmp')
248    blacklist('_ image gen_platf 32bpp-pixeldata-cropped.bmp')
249    blacklist('_ image gen_platf 24bpp-pixeldata-cropped.bmp')
250    if 'x86_64' in bot and 'CPU' in bot:
251      # This GM triggers a SkSmallAllocator assert.
252      blacklist('_ gm _ composeshader_bitmap')
253
254  # WIC and CG fail on arithmetic jpegs
255  if 'Win' in bot or 'Mac' in bot:
256    blacklist('_ image gen_platf testimgari.jpg')
257
258  if 'Android' in bot or 'iOS' in bot:
259    # This test crashes the N9 (perhaps because of large malloc/frees). It also
260    # is fairly slow and not platform-specific. So we just disable it on all of
261    # Android and iOS. skia:5438
262    blacklist('_ test _ GrShape')
263
264  # skia:4095
265  bad_serialize_gms = ['bleed_image',
266                       'c_gms',
267                       'colortype',
268                       'colortype_xfermodes',
269                       'drawfilter',
270                       'fontmgr_bounds_0.75_0',
271                       'fontmgr_bounds_1_-0.25',
272                       'fontmgr_bounds',
273                       'fontmgr_match',
274                       'fontmgr_iter',
275                       'imagemasksubset']
276
277  # skia:5589
278  bad_serialize_gms.extend(['bitmapfilters',
279                            'bitmapshaders',
280                            'bleed',
281                            'bleed_alpha_bmp',
282                            'bleed_alpha_bmp_shader',
283                            'convex_poly_clip',
284                            'extractalpha',
285                            'filterbitmap_checkerboard_32_32_g8',
286                            'filterbitmap_image_mandrill_64',
287                            'shadows',
288                            'simpleaaclip_aaclip'])
289  # skia:5595
290  bad_serialize_gms.extend(['composeshader_bitmap',
291                            'scaled_tilemodes_npot',
292                            'scaled_tilemodes'])
293
294  # skia:5778
295  bad_serialize_gms.append('typefacerendering_pfaMac')
296  # skia:5942
297  bad_serialize_gms.append('parsedpaths')
298
299  # these use a custom image generator which doesn't serialize
300  bad_serialize_gms.append('ImageGeneratorExternal_rect')
301  bad_serialize_gms.append('ImageGeneratorExternal_shader')
302
303  # skia:6189
304  bad_serialize_gms.append('shadow_utils')
305
306  # Not expected to round trip encoding/decoding.
307  bad_serialize_gms.append('makecolorspace')
308
309  for test in bad_serialize_gms:
310    blacklist(['serialize-8888', 'gm', '_', test])
311
312  if 'Mac' not in bot:
313    for test in ['bleed_alpha_image', 'bleed_alpha_image_shader']:
314      blacklist(['serialize-8888', 'gm', '_', test])
315  # It looks like we skip these only for out-of-memory concerns.
316  if 'Win' in bot or 'Android' in bot:
317    for test in ['verylargebitmap', 'verylarge_picture_image']:
318      blacklist(['serialize-8888', 'gm', '_', test])
319
320  # skia:4769
321  for test in ['drawfilter']:
322    blacklist([    'sp-8888', 'gm', '_', test])
323    blacklist([   'pic-8888', 'gm', '_', test])
324    blacklist(['2ndpic-8888', 'gm', '_', test])
325    blacklist([  'lite-8888', 'gm', '_', test])
326  # skia:4703
327  for test in ['image-cacherator-from-picture',
328               'image-cacherator-from-raster',
329               'image-cacherator-from-ctable']:
330    blacklist([       'sp-8888', 'gm', '_', test])
331    blacklist([      'pic-8888', 'gm', '_', test])
332    blacklist([   '2ndpic-8888', 'gm', '_', test])
333    blacklist(['serialize-8888', 'gm', '_', test])
334
335  # GM that requires raster-backed canvas
336  for test in ['gamut', 'complexclip4_bw', 'complexclip4_aa']:
337    blacklist([       'sp-8888', 'gm', '_', test])
338    blacklist([      'pic-8888', 'gm', '_', test])
339    blacklist([     'lite-8888', 'gm', '_', test])
340    blacklist([   '2ndpic-8888', 'gm', '_', test])
341    blacklist(['serialize-8888', 'gm', '_', test])
342
343  # GM that not support tiles_rt
344  for test in ['complexclip4_bw', 'complexclip4_aa']:
345    blacklist([ 'tiles_rt-8888', 'gm', '_', test])
346
347  # Extensions for RAW images
348  r = ["arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw",
349       "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW"]
350
351  # skbug.com/4888
352  # Blacklist RAW images (and a few large PNGs) on GPU bots
353  # until we can resolve failures.
354  if 'GPU' in bot:
355    blacklist('_ image _ interlaced1.png')
356    blacklist('_ image _ interlaced2.png')
357    blacklist('_ image _ interlaced3.png')
358    for raw_ext in r:
359      blacklist('_ image _ .%s' % raw_ext)
360
361  # Blacklist memory intensive tests on 32-bit bots.
362  if ('Win2k8' in bot or 'Win8' in bot) and 'x86-' in bot:
363    blacklist('_ image f16 _')
364    blacklist('_ image _ abnormal.wbmp')
365    blacklist('_ image _ interlaced1.png')
366    blacklist('_ image _ interlaced2.png')
367    blacklist('_ image _ interlaced3.png')
368    for raw_ext in r:
369      blacklist('_ image _ .%s' % raw_ext)
370
371  if 'IntelHD405' in bot and 'Ubuntu16' in bot:
372    # skia:6331
373    blacklist(['glmsaa8',   'image', 'gen_codec_gpu', 'abnormal.wbmp'])
374    blacklist(['glesmsaa4', 'image', 'gen_codec_gpu', 'abnormal.wbmp'])
375
376  if 'Nexus5' in bot:
377    # skia:5876
378    blacklist(['_', 'gm', '_', 'encode-platform'])
379
380  if 'AndroidOne-GPU' in bot:  # skia:4697, skia:4704, skia:4694, skia:4705
381    blacklist(['_',            'gm', '_', 'bigblurs'])
382    blacklist(['_',            'gm', '_', 'bleed'])
383    blacklist(['_',            'gm', '_', 'bleed_alpha_bmp'])
384    blacklist(['_',            'gm', '_', 'bleed_alpha_bmp_shader'])
385    blacklist(['_',            'gm', '_', 'bleed_alpha_image'])
386    blacklist(['_',            'gm', '_', 'bleed_alpha_image_shader'])
387    blacklist(['_',            'gm', '_', 'bleed_image'])
388    blacklist(['_',            'gm', '_', 'dropshadowimagefilter'])
389    blacklist(['_',            'gm', '_', 'filterfastbounds'])
390    blacklist([gl_prefix,      'gm', '_', 'imageblurtiled'])
391    blacklist(['_',            'gm', '_', 'imagefiltersclipped'])
392    blacklist(['_',            'gm', '_', 'imagefiltersscaled'])
393    blacklist(['_',            'gm', '_', 'imageresizetiled'])
394    blacklist(['_',            'gm', '_', 'matrixconvolution'])
395    blacklist(['_',            'gm', '_', 'strokedlines'])
396    if sample_count is not '':
397      gl_msaa_config = gl_prefix + 'msaa' + sample_count
398      blacklist([gl_msaa_config, 'gm', '_', 'imageblurtiled'])
399      blacklist([gl_msaa_config, 'gm', '_', 'imagefiltersbase'])
400
401  match = []
402  if 'Valgrind' in bot: # skia:3021
403    match.append('~Threaded')
404
405  if 'Valgrind' in bot and 'PreAbandonGpuContext' in bot:
406    # skia:6575
407    match.append('~multipicturedraw_')
408
409  if 'CommandBuffer' in bot:
410    # https://crbug.com/697030
411    match.append('~HalfFloatAlphaTextureTest')
412
413  if 'AndroidOne' in bot:  # skia:4711
414    match.append('~WritePixels')
415
416  if 'NexusPlayer' in bot:
417    match.append('~ResourceCache')
418
419  if 'Nexus10' in bot:
420    match.append('~CopySurface') # skia:5509
421    match.append('~SRGBReadWritePixels') # skia:6097
422
423  if 'GalaxyS6' in bot:
424    match.append('~SpecialImage') # skia:6338
425    match.append('~skbug6653') # skia:6653
426
427  if 'GalaxyS7_G930A' in bot:
428    match.append('~WritePixels') # skia:6427
429
430  if 'MSAN' in bot:
431    match.extend(['~Once', '~Shared'])  # Not sure what's up with these tests.
432
433  if 'TSAN' in bot:
434    match.extend(['~ReadWriteAlpha'])   # Flaky on TSAN-covered on nvidia bots.
435    match.extend(['~RGBA4444TextureTest',  # Flakier than they are important.
436                  '~RGB565TextureTest'])
437
438  if 'Vulkan' in bot and 'Adreno530' in bot:
439      # skia:5777
440      match.extend(['~CopySurface'])
441
442  if 'Vulkan' in bot and 'NexusPlayer' in bot:
443    match.extend(['~gradients_no_texture$', # skia:6132
444                  '~tilemodes', # skia:6132
445                  '~shadertext$', # skia:6132
446                  '~bitmapfilters', # skia:6132
447                  '~GrContextFactory_abandon']) #skia:6209
448
449  if 'Vulkan' in bot and 'IntelIris540' in bot and api.vars.is_linux:
450    match.extend(['~VkHeapTests']) # skia:6245
451
452  if 'Intel' in bot and api.vars.is_linux and not 'Vulkan' in bot:
453    # TODO(dogben): Track down what's causing bots to die.
454    verbose = True
455
456  if 'Vulkan' in bot and 'IntelIris540' in bot and 'Win' in bot:
457    # skia:6398
458    blacklist(['vk', 'gm', '_', 'aarectmodes'])
459    blacklist(['vk', 'gm', '_', 'aaxfermodes'])
460    blacklist(['vk', 'gm', '_', 'arithmode'])
461    blacklist(['vk', 'gm', '_', 'composeshader_bitmap'])
462    blacklist(['vk', 'gm', '_', 'composeshader_bitmap2'])
463    blacklist(['vk', 'gm', '_', 'dftextCOLR'])
464    blacklist(['vk', 'gm', '_', 'drawregionmodes'])
465    blacklist(['vk', 'gm', '_', 'filterfastbounds'])
466    blacklist(['vk', 'gm', '_', 'fontcache'])
467    blacklist(['vk', 'gm', '_', 'fontmgr_iterWin10'])
468    blacklist(['vk', 'gm', '_', 'fontmgr_iter_factoryWin10'])
469    blacklist(['vk', 'gm', '_', 'fontmgr_matchWin10'])
470    blacklist(['vk', 'gm', '_', 'fontscalerWin'])
471    blacklist(['vk', 'gm', '_', 'fontscalerdistortable'])
472    blacklist(['vk', 'gm', '_', 'gammagradienttext'])
473    blacklist(['vk', 'gm', '_', 'gammatextWin'])
474    blacklist(['vk', 'gm', '_', 'gradtext'])
475    blacklist(['vk', 'gm', '_', 'hairmodes'])
476    blacklist(['vk', 'gm', '_', 'imagefilters_xfermodes'])
477    blacklist(['vk', 'gm', '_', 'imagefiltersclipped'])
478    blacklist(['vk', 'gm', '_', 'imagefiltersgraph'])
479    blacklist(['vk', 'gm', '_', 'imagefiltersscaled'])
480    blacklist(['vk', 'gm', '_', 'imagefiltersstroked'])
481    blacklist(['vk', 'gm', '_', 'imagefilterstransformed'])
482    blacklist(['vk', 'gm', '_', 'imageresizetiled'])
483    blacklist(['vk', 'gm', '_', 'lcdblendmodes'])
484    blacklist(['vk', 'gm', '_', 'lcdoverlap'])
485    blacklist(['vk', 'gm', '_', 'lcdtextWin'])
486    blacklist(['vk', 'gm', '_', 'lcdtextsize'])
487    blacklist(['vk', 'gm', '_', 'matriximagefilter'])
488    blacklist(['vk', 'gm', '_', 'mixedtextblobsCOLR'])
489    blacklist(['vk', 'gm', '_', 'mixershader'])
490    blacklist(['vk', 'gm', '_', 'pictureimagefilter'])
491    blacklist(['vk', 'gm', '_', 'resizeimagefilter'])
492    blacklist(['vk', 'gm', '_', 'rotate_imagefilter'])
493    blacklist(['vk', 'gm', '_', 'savelayer_lcdtext'])
494    blacklist(['vk', 'gm', '_', 'srcmode'])
495    blacklist(['vk', 'gm', '_', 'surfaceprops'])
496    blacklist(['vk', 'gm', '_', 'textblobgeometrychange'])
497    blacklist(['vk', 'gm', '_', 'textbloblooper'])
498    blacklist(['vk', 'gm', '_', 'textblobmixedsizes'])
499    blacklist(['vk', 'gm', '_', 'textblobmixedsizes_df'])
500    blacklist(['vk', 'gm', '_', 'textblobrandomfont'])
501    blacklist(['vk', 'gm', '_', 'textfilter_color'])
502    blacklist(['vk', 'gm', '_', 'textfilter_image'])
503    blacklist(['vk', 'gm', '_', 'typefacerenderingWin'])
504    blacklist(['vk', 'gm', '_', 'varied_text_clipped_lcd'])
505    blacklist(['vk', 'gm', '_', 'varied_text_ignorable_clip_lcd'])
506    blacklist(['vk', 'gm', '_', 'xfermodeimagefilter'])
507    match.append('~ApplyGamma')
508    match.append('~ComposedImageFilterBounds_Gpu')
509    match.append('~DeferredTextureImage')
510    match.append('~GrMeshTest')
511    match.append('~ImageFilterFailAffectsTransparentBlack_Gpu')
512    match.append('~ImageFilterZeroBlurSigma_Gpu')
513    match.append('~ImageNewShader_GPU')
514    match.append('~NewTextureFromPixmap')
515    match.append('~ReadPixels_Gpu')
516    match.append('~ReadPixels_Texture')
517    match.append('~ReadWriteAlpha')
518    match.append('~skbug6653')
519    match.append('~SRGBReadWritePixels')
520    match.append('~SpecialImage_DeferredGpu')
521    match.append('~SpecialImage_Gpu')
522    match.append('~WritePixels_Gpu')
523    match.append('~WritePixelsNonTexture_Gpu')
524    match.append('~XfermodeImageFilterCroppedInput_Gpu')
525
526  if 'IntelIris540' in bot and 'ANGLE' in bot:
527    for config in ['angle_d3d9_es2', 'angle_d3d11_es2', 'angle_gl_es2']:
528      # skia:6103
529      blacklist([config, 'gm', '_', 'multipicturedraw_invpathclip_simple'])
530      blacklist([config, 'gm', '_', 'multipicturedraw_noclip_simple'])
531      blacklist([config, 'gm', '_', 'multipicturedraw_pathclip_simple'])
532      blacklist([config, 'gm', '_', 'multipicturedraw_rectclip_simple'])
533      blacklist([config, 'gm', '_', 'multipicturedraw_rrectclip_simple'])
534      # skia:6141
535      blacklist([config, 'gm', '_', 'discard'])
536
537  if 'IntelBayTrail' in bot and api.vars.is_linux:
538    match.append('~ImageStorageLoad') # skia:6358
539
540  if 'Ci20' in bot:
541    match.append('~Codec_Dimensions') # skia:6477
542    match.append('~FontMgrAndroidParser') # skia:6478
543    match.append('~PathOpsSimplify') # skia:6479
544    blacklist(['_', 'gm', '_', 'fast_slow_blurimagefilter']) # skia:6480
545
546  if ('Win10' in bot and 'Vulkan' in bot
547      and ('GTX1070' in bot or 'GTX660' in bot)):
548    blacklist('_ test _ SkImage_makeTextureImage') # skia:6554
549
550  if blacklisted:
551    args.append('--blacklist')
552    args.extend(blacklisted)
553
554  if match:
555    args.append('--match')
556    args.extend(match)
557
558  # These bots run out of memory running RAW codec tests. Do not run them in
559  # parallel
560  if ('NexusPlayer' in bot or 'Nexus5' in bot or 'Nexus9' in bot
561      or 'Win8-MSVC-ShuttleB' in bot):
562    args.append('--noRAW_threading')
563
564  if 'Valgrind' in bot and 'PreAbandonGpuContext' in bot:
565    verbose = True
566
567  if 'NexusPlayer' in bot and 'CPU' in bot:
568    # The Nexus Player's image decoding tests are slow enough that swarming
569    # times it out for not printing anything frequently enough.  --verbose
570    # makes dm print something every time we start or complete a task.
571    verbose = True
572
573  if verbose:
574    args.append('--verbose')
575
576  return args
577
578
579def key_params(api):
580  """Build a unique key from the builder name (as a list).
581
582  E.g.  arch x86 gpu GeForce320M mode MacMini4.1 os Mac10.6
583  """
584  # Don't bother to include role, which is always Test.
585  # TryBots are uploaded elsewhere so they can use the same key.
586  blacklist = ['role', 'is_trybot']
587
588  flat = []
589  for k in sorted(api.vars.builder_cfg.keys()):
590    if k not in blacklist:
591      flat.append(k)
592      flat.append(api.vars.builder_cfg[k])
593  return flat
594
595
596def test_steps(api):
597  """Run the DM test."""
598  use_hash_file = False
599  if api.vars.upload_dm_results:
600    # This must run before we write anything into
601    # api.flavor.device_dirs.dm_dir or we may end up deleting our
602    # output on machines where they're the same.
603    api.flavor.create_clean_host_dir(api.vars.dm_dir)
604    host_dm_dir = str(api.vars.dm_dir)
605    device_dm_dir = str(api.flavor.device_dirs.dm_dir)
606    if host_dm_dir != device_dm_dir:
607      api.flavor.create_clean_device_dir(device_dm_dir)
608
609    # Obtain the list of already-generated hashes.
610    hash_filename = 'uninteresting_hashes.txt'
611
612    # Ensure that the tmp_dir exists.
613    api.run.run_once(api.file.ensure_directory,
614                     'makedirs tmp_dir',
615                     api.vars.tmp_dir)
616
617    host_hashes_file = api.vars.tmp_dir.join(hash_filename)
618    hashes_file = api.flavor.device_path_join(
619        api.flavor.device_dirs.tmp_dir, hash_filename)
620    api.run(
621        api.python.inline,
622        'get uninteresting hashes',
623        program="""
624        import contextlib
625        import math
626        import socket
627        import sys
628        import time
629        import urllib2
630
631        HASHES_URL = 'https://storage.googleapis.com/skia-infra-gm/hash_files/gold-prod-hashes.txt'
632        RETRIES = 5
633        TIMEOUT = 60
634        WAIT_BASE = 15
635
636        socket.setdefaulttimeout(TIMEOUT)
637        for retry in range(RETRIES):
638          try:
639            with contextlib.closing(
640                urllib2.urlopen(HASHES_URL, timeout=TIMEOUT)) as w:
641              hashes = w.read()
642              with open(sys.argv[1], 'w') as f:
643                f.write(hashes)
644                break
645          except Exception as e:
646            print 'Failed to get uninteresting hashes from %s:' % HASHES_URL
647            print e
648            if retry == RETRIES:
649              raise
650            waittime = WAIT_BASE * math.pow(2, retry)
651            print 'Retry in %d seconds.' % waittime
652            time.sleep(waittime)
653        """,
654        args=[host_hashes_file],
655        abort_on_failure=False,
656        fail_build_on_failure=False,
657        infra_step=True)
658
659    if api.path.exists(host_hashes_file):
660      api.flavor.copy_file_to_device(host_hashes_file, hashes_file)
661      use_hash_file = True
662
663  # Run DM.
664  properties = [
665    'gitHash',      api.vars.got_revision,
666    'builder',      api.vars.builder_name,
667  ]
668  if api.vars.is_trybot:
669    properties.extend([
670      'issue',         api.vars.issue,
671      'patchset',      api.vars.patchset,
672      'patch_storage', api.vars.patch_storage,
673    ])
674  properties.extend(['swarming_bot_id', api.vars.swarming_bot_id])
675  properties.extend(['swarming_task_id', api.vars.swarming_task_id])
676
677  args = [
678    'dm',
679    '--undefok',   # This helps branches that may not know new flags.
680    '--resourcePath', api.flavor.device_dirs.resource_dir,
681    '--skps', api.flavor.device_dirs.skp_dir,
682    '--images', api.flavor.device_path_join(
683        api.flavor.device_dirs.images_dir, 'dm'),
684    '--colorImages', api.flavor.device_path_join(
685        api.flavor.device_dirs.images_dir, 'colorspace'),
686    '--nameByHash',
687    '--properties'
688  ] + properties
689
690  args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
691
692  args.append('--key')
693  args.extend(key_params(api))
694  if use_hash_file:
695    args.extend(['--uninterestingHashesFile', hashes_file])
696  if api.vars.upload_dm_results:
697    args.extend(['--writePath', api.flavor.device_dirs.dm_dir])
698
699  skip_flag = None
700  if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU':
701    skip_flag = '--nogpu'
702  elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU':
703    skip_flag = '--nocpu'
704  if skip_flag:
705    args.append(skip_flag)
706  args.extend(dm_flags(api, api.vars.builder_name))
707
708  env = {}
709  if 'Ubuntu16' in api.vars.builder_name:
710    # The vulkan in this asset name simply means that the graphics driver
711    # supports Vulkan. It is also the driver used for GL code.
712    dri_path = api.vars.slave_dir.join('linux_vulkan_intel_driver_release')
713    if 'Debug' in api.vars.builder_name:
714      dri_path = api.vars.slave_dir.join('linux_vulkan_intel_driver_debug')
715
716    if 'Vulkan' in api.vars.builder_name:
717      sdk_path = api.vars.slave_dir.join('linux_vulkan_sdk', 'bin')
718      lib_path = api.vars.slave_dir.join('linux_vulkan_sdk', 'lib')
719      env.update({
720        'PATH':'%%(PATH)s:%s' % sdk_path,
721        'LD_LIBRARY_PATH': '%s:%s' % (lib_path, dri_path),
722        'LIBGL_DRIVERS_PATH': dri_path,
723        'VK_ICD_FILENAMES':'%s' % dri_path.join('intel_icd.x86_64.json'),
724      })
725    else:
726      # Even the non-vulkan NUC jobs could benefit from the newer drivers.
727      env.update({
728        'LD_LIBRARY_PATH': dri_path,
729        'LIBGL_DRIVERS_PATH': dri_path,
730      })
731
732  # See skia:2789.
733  extra_config_parts = api.vars.builder_cfg.get('extra_config', '').split('_')
734  if 'AbandonGpuContext' in extra_config_parts:
735    args.append('--abandonGpuContext')
736  if 'PreAbandonGpuContext' in extra_config_parts:
737    args.append('--preAbandonGpuContext')
738  if 'ReleaseAndAbandonGpuContext' in extra_config_parts:
739    args.append('--releaseAndAbandonGpuContext')
740
741  with api.env(env):
742    api.run(api.flavor.step, 'dm', cmd=args, abort_on_failure=False)
743
744  if api.vars.upload_dm_results:
745    # Copy images and JSON to host machine if needed.
746    api.flavor.copy_directory_contents_to_host(
747        api.flavor.device_dirs.dm_dir, api.vars.dm_dir)
748
749
750def RunSteps(api):
751  api.core.setup()
752  env = {}
753  if 'iOS' in api.vars.builder_name:
754    env['IOS_BUNDLE_ID'] = 'com.google.dm'
755    env['IOS_MOUNT_POINT'] = api.vars.slave_dir.join('mnt_iosdevice')
756  with api.context(env=env):
757    try:
758      api.flavor.install_everything()
759      test_steps(api)
760    finally:
761      api.flavor.cleanup_steps()
762    api.run.check_failure()
763
764
765TEST_BUILDERS = [
766  'Test-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-Android',
767  'Test-Android-Clang-Ci20-CPU-IngenicJZ4780-mipsel-Release-Android',
768  'Test-Android-Clang-GalaxyS6-GPU-MaliT760-arm64-Debug-Android',
769  'Test-Android-Clang-GalaxyS7_G930A-GPU-Adreno530-arm64-Debug-Android',
770  'Test-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-Android',
771  'Test-Android-Clang-Nexus10-GPU-MaliT604-arm-Release-Android',
772  'Test-Android-Clang-Nexus5-GPU-Adreno330-arm-Release-Android',
773  'Test-Android-Clang-PixelXL-GPU-Adreno530-arm64-Debug-Android_CCPR',
774  'Test-Android-Clang-Nexus6p-GPU-Adreno430-arm64-Debug-Android_Vulkan',
775  'Test-Android-Clang-PixelXL-GPU-Adreno530-arm64-Debug-Android_Vulkan',
776  'Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Debug-Android',
777  'Test-Android-Clang-NexusPlayer-CPU-SSE4-x86-Release-Android',
778  'Test-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-Android_Vulkan',
779  'Test-Android-Clang-PixelC-CPU-TegraX1-arm64-Debug-Android',
780  'Test-ChromeOS-Clang-Chromebook_C100p-GPU-MaliT764-arm-Debug',
781  'Test-Mac-Clang-MacMini6.2-CPU-AVX-x86_64-Debug',
782  'Test-Mac-Clang-MacMini6.2-GPU-IntelHD4000-x86_64-Debug-CommandBuffer',
783  'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-ASAN',
784  'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Debug-MSAN',
785  'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN',
786  'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug',
787  'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug',
788  'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
789  ('Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind' +
790   '_AbandonGpuContext'),
791  ('Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind' +
792   '_PreAbandonGpuContext'),
793  ('Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-SK_USE_DISCARDABLE_' +
794    'SCALEDIMAGECACHE'),
795  'Test-Ubuntu16-Clang-NUC5PPYH-GPU-IntelHD405-x86_64-Debug',
796  'Test-Ubuntu16-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-Vulkan',
797  'Test-Ubuntu16-Clang-NUC6i5SYK-GPU-IntelIris540-x86_64-Release',
798  'Test-Ubuntu16-Clang-NUCDE3815TYKHE-GPU-IntelBayTrail-x86_64-Debug',
799  'Test-Win8-MSVC-Golo-CPU-AVX-x86-Debug',
800  'Test-Win10-MSVC-AlphaR2-GPU-RadeonR9M470X-x86_64-Debug-Vulkan',
801  ('Test-Win10-MSVC-NUC5i7RYH-GPU-IntelIris6100-x86_64-Release-'
802   'ReleaseAndAbandonGpuContext'),
803  'Test-Win10-MSVC-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-ANGLE',
804  'Test-Win10-MSVC-NUC6i5SYK-GPU-IntelIris540-x86_64-Debug-Vulkan',
805  'Test-Win10-MSVC-ShuttleA-GPU-GTX660-x86_64-Debug-Vulkan',
806  'Test-Win10-MSVC-ShuttleC-GPU-GTX960-x86_64-Debug-ANGLE',
807  'Test-Win10-MSVC-ZBOX-GPU-GTX1070-x86_64-Debug-Vulkan',
808  'Test-iOS-Clang-iPadMini4-GPU-GX6450-arm-Release',
809  ('Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-'
810   'SK_FORCE_RASTER_PIPELINE_BLITTER'),
811]
812
813
814def GenTests(api):
815  for builder in TEST_BUILDERS:
816    test = (
817      api.test(builder) +
818      api.properties(buildername=builder,
819                     revision='abc123',
820                     path_config='kitchen',
821                     swarm_out_dir='[SWARM_OUT_DIR]') +
822      api.path.exists(
823          api.path['start_dir'].join('skia'),
824          api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
825                                     'skimage', 'VERSION'),
826          api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
827                                     'skp', 'VERSION'),
828          api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
829                                     'svg', 'VERSION'),
830          api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
831      ) +
832      api.step_data('get swarming bot id',
833          stdout=api.raw_io.output('skia-bot-123')) +
834      api.step_data('get swarming task id',
835          stdout=api.raw_io.output('123456'))
836    )
837    if 'Win' in builder:
838      test += api.platform('win', 64)
839
840    if 'ChromeOS' in builder:
841      test += api.step_data(
842          'read chromeos ip',
843          stdout=api.raw_io.output('{"user_ip":"foo@127.0.0.1"}'))
844
845
846    yield test
847
848  builder = 'Test-Win2k8-MSVC-GCE-CPU-AVX2-x86_64-Release'
849  yield (
850    api.test('trybot') +
851    api.properties(buildername=builder,
852                   revision='abc123',
853                   path_config='kitchen',
854                   swarm_out_dir='[SWARM_OUT_DIR]') +
855    api.properties(patch_storage='gerrit') +
856    api.properties.tryserver(
857          buildername=builder,
858          gerrit_project='skia',
859          gerrit_url='https://skia-review.googlesource.com/',
860      )+
861    api.path.exists(
862        api.path['start_dir'].join('skia'),
863        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
864                                     'skimage', 'VERSION'),
865        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
866                                     'skp', 'VERSION'),
867        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
868                                     'svg', 'VERSION'),
869        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
870    )
871  )
872
873  builder = 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug'
874  yield (
875    api.test('failed_dm') +
876    api.properties(buildername=builder,
877                   revision='abc123',
878                   path_config='kitchen',
879                   swarm_out_dir='[SWARM_OUT_DIR]') +
880    api.path.exists(
881        api.path['start_dir'].join('skia'),
882        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
883                                     'skimage', 'VERSION'),
884        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
885                                     'skp', 'VERSION'),
886        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
887                                     'svg', 'VERSION'),
888        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
889    ) +
890    api.step_data('symbolized dm', retcode=1)
891  )
892
893  builder = 'Test-Android-Clang-Nexus7-GPU-Tegra3-arm-Debug-Android'
894  yield (
895    api.test('failed_get_hashes') +
896    api.properties(buildername=builder,
897                   revision='abc123',
898                   path_config='kitchen',
899                   swarm_out_dir='[SWARM_OUT_DIR]') +
900    api.path.exists(
901        api.path['start_dir'].join('skia'),
902        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
903                                     'skimage', 'VERSION'),
904        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
905                                     'skp', 'VERSION'),
906        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
907                                     'svg', 'VERSION'),
908        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
909    ) +
910    api.step_data('get uninteresting hashes', retcode=1)
911  )
912
913  builder = 'Test-Android-Clang-NexusPlayer-CPU-SSE4-x86-Debug-Android'
914  yield (
915    api.test('failed_push') +
916    api.properties(buildername=builder,
917                   revision='abc123',
918                   path_config='kitchen',
919                   swarm_out_dir='[SWARM_OUT_DIR]') +
920    api.path.exists(
921        api.path['start_dir'].join('skia'),
922        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
923                                     'skimage', 'VERSION'),
924        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
925                                     'skp', 'VERSION'),
926        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
927                                     'svg', 'VERSION'),
928        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
929    ) +
930    api.step_data('push [START_DIR]/skia/resources/* '+
931                  '/sdcard/revenge_of_the_skiabot/resources', retcode=1)
932  )
933
934  builder = 'Test-Android-Clang-Nexus10-GPU-MaliT604-arm-Debug-Android'
935  yield (
936    api.test('failed_pull') +
937    api.properties(buildername=builder,
938                   revision='abc123',
939                   path_config='kitchen',
940                   swarm_out_dir='[SWARM_OUT_DIR]') +
941    api.path.exists(
942        api.path['start_dir'].join('skia'),
943        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
944                                     'skimage', 'VERSION'),
945        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
946                                     'skp', 'VERSION'),
947        api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',
948                                     'svg', 'VERSION'),
949        api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt')
950    ) +
951    api.step_data('dm', retcode=1) +
952    api.step_data('pull /sdcard/revenge_of_the_skiabot/dm_out '+
953                  '[CUSTOM_[SWARM_OUT_DIR]]/dm', retcode=1)
954  )
955