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 9from recipe_engine import recipe_api 10 11 12def dm_flags(bot): 13 args = [] 14 15 # This enables non-deterministic random seeding of the GPU FP optimization 16 # test. Limit testing until we're sure it's not going to cause an 17 # avalanche of problems. 18 if 'Ubuntu' in bot or 'Win' in bot or 'Mac' in bot: 19 args.append('--randomProcessorTest') 20 21 # 32-bit desktop bots tend to run out of memory, because they have relatively 22 # far more cores than RAM (e.g. 32 cores, 3G RAM). Hold them back a bit. 23 if '-x86-' in bot and not 'NexusPlayer' in bot: 24 args.extend('--threads 4'.split(' ')) 25 26 # Avoid issues with dynamically exceeding resource cache limits. 27 if 'Test' in bot and 'DISCARDABLE' in bot: 28 args.extend('--threads 0'.split(' ')) 29 30 # These are the canonical configs that we would ideally run on all bots. We 31 # may opt out or substitute some below for specific bots 32 configs = ['8888', 'srgb', 'pdf'] 33 # Add in either gles or gl configs to the canonical set based on OS 34 sample_count = '8' 35 gl_prefix = 'gl' 36 if 'Android' in bot or 'iOS' in bot: 37 sample_count = '4' 38 # We want to test the OpenGL config not the GLES config on the Shield 39 if 'NVIDIA_Shield' not in bot: 40 gl_prefix = 'gles' 41 elif 'Intel' in bot: 42 sample_count = '' 43 44 configs.extend([gl_prefix, gl_prefix + 'dft', gl_prefix + 'srgb']) 45 if sample_count is not '': 46 configs.append(gl_prefix + 'msaa' + sample_count) 47 48 # The NP produces a long error stream when we run with MSAA. The Tegra3 just 49 # doesn't support it. 50 if ('NexusPlayer' in bot or 51 'Tegra3' in bot or 52 # We aren't interested in fixing msaa bugs on iPad4. 53 'iPad4' in bot or 54 # skia:5792 55 'iHD530' in bot or 56 'IntelIris540' in bot): 57 configs = [x for x in configs if 'msaa' not in x] 58 59 # The NP produces different images for dft on every run. 60 if 'NexusPlayer' in bot: 61 configs = [x for x in configs if 'dft' not in x] 62 63 # Runs out of memory on Android bots. Everyone else seems fine. 64 if 'Android' in bot: 65 configs.remove('pdf') 66 67 if '-GCE-' in bot: 68 configs.extend(['565']) 69 configs.extend(['f16']) 70 configs.extend(['sp-8888', '2ndpic-8888']) # Test niche uses of SkPicture. 71 configs.extend(['lite-8888']) # Experimental display list. 72 configs.extend(['gbr-8888']) 73 74 if '-TSAN' not in bot and sample_count is not '': 75 if ('TegraK1' in bot or 76 'TegraX1' in bot or 77 'GTX550Ti' in bot or 78 'GTX660' in bot or 79 'GT610' in bot): 80 configs.append(gl_prefix + 'nvprdit' + sample_count) 81 82 # We want to test both the OpenGL config and the GLES config on Linux Intel: 83 # GL is used by Chrome, GLES is used by ChromeOS. 84 if 'Intel' in bot and 'Ubuntu' in bot: 85 configs.extend(['gles', 'glesdft', 'glessrgb']) 86 87 # NP is running out of RAM when we run all these modes. skia:3255 88 if 'NexusPlayer' not in bot: 89 configs.extend(mode + '-8888' for mode in 90 ['serialize', 'tiles_rt', 'pic']) 91 92 # Test instanced rendering on a limited number of platforms 93 if 'Nexus6' in bot: 94 configs.append(gl_prefix + 'inst') # inst msaa isn't working yet on Adreno. 95 elif 'NVIDIA_Shield' in bot or 'PixelC' in bot: 96 # Multisampled instanced configs use nvpr so we substitute inst msaa 97 # configs for nvpr msaa configs. 98 old = gl_prefix + 'nvpr' 99 new = gl_prefix + 'inst' 100 configs = [x.replace(old, new) for x in configs] 101 # We also test non-msaa instanced. 102 configs.append(new) 103 elif 'MacMini6.2' in bot and sample_count is not '': 104 configs.extend([gl_prefix + 'inst', gl_prefix + 'inst' + sample_count]) 105 106 # CommandBuffer bot *only* runs the command_buffer config. 107 if 'CommandBuffer' in bot: 108 configs = ['commandbuffer'] 109 110 # ANGLE bot *only* runs the angle configs 111 if 'ANGLE' in bot: 112 configs = ['angle_d3d11_es2', 113 'angle_d3d9_es2', 114 'angle_gl_es2'] 115 if sample_count is not '': 116 configs.append('angle_d3d11_es2_msaa' + sample_count) 117 118 # Vulkan bot *only* runs the vk config. 119 if 'Vulkan' in bot: 120 configs = ['vk'] 121 122 args.append('--config') 123 args.extend(configs) 124 125 # Run tests, gms, and image decoding tests everywhere. 126 args.extend('--src tests gm image colorImage svg'.split(' ')) 127 if 'Vulkan' in bot and 'NexusPlayer' in bot: 128 args.remove('svg') 129 args.remove('image') 130 131 blacklisted = [] 132 def blacklist(quad): 133 config, src, options, name = quad.split(' ') if type(quad) is str else quad 134 if config == '_' or config in configs: 135 blacklisted.extend([config, src, options, name]) 136 137 # TODO: ??? 138 blacklist('f16 _ _ dstreadshuffle') 139 blacklist('glsrgb image _ _') 140 blacklist('glessrgb image _ _') 141 142 # Decoder tests are now performing gamma correct decodes. This means 143 # that, when viewing the results, we need to perform a gamma correct 144 # encode to PNG. Therefore, we run the image tests in srgb mode instead 145 # of 8888. 146 blacklist('8888 image _ _') 147 148 # Not any point to running these. 149 blacklist('gbr-8888 image _ _') 150 blacklist('gbr-8888 colorImage _ _') 151 152 if 'Valgrind' in bot: 153 # These take 18+ hours to run. 154 blacklist('pdf gm _ fontmgr_iter') 155 blacklist('pdf _ _ PANO_20121023_214540.jpg') 156 blacklist('pdf skp _ worldjournal') 157 blacklist('pdf skp _ desk_baidu.skp') 158 blacklist('pdf skp _ desk_wikipedia.skp') 159 blacklist('_ svg _ _') 160 161 if 'iOS' in bot: 162 blacklist(gl_prefix + ' skp _ _') 163 164 if 'Mac' in bot or 'iOS' in bot: 165 # CG fails on questionable bmps 166 blacklist('_ image gen_platf rgba32abf.bmp') 167 blacklist('_ image gen_platf rgb24prof.bmp') 168 blacklist('_ image gen_platf rgb24lprof.bmp') 169 blacklist('_ image gen_platf 8bpp-pixeldata-cropped.bmp') 170 blacklist('_ image gen_platf 4bpp-pixeldata-cropped.bmp') 171 blacklist('_ image gen_platf 32bpp-pixeldata-cropped.bmp') 172 blacklist('_ image gen_platf 24bpp-pixeldata-cropped.bmp') 173 174 # CG has unpredictable behavior on this questionable gif 175 # It's probably using uninitialized memory 176 blacklist('_ image gen_platf frame_larger_than_image.gif') 177 178 # CG has unpredictable behavior on incomplete pngs 179 # skbug.com/5774 180 blacklist('_ image gen_platf inc0.png') 181 blacklist('_ image gen_platf inc1.png') 182 blacklist('_ image gen_platf inc2.png') 183 blacklist('_ image gen_platf inc3.png') 184 blacklist('_ image gen_platf inc4.png') 185 blacklist('_ image gen_platf inc5.png') 186 blacklist('_ image gen_platf inc6.png') 187 blacklist('_ image gen_platf inc7.png') 188 blacklist('_ image gen_platf inc8.png') 189 blacklist('_ image gen_platf inc9.png') 190 blacklist('_ image gen_platf inc10.png') 191 blacklist('_ image gen_platf inc11.png') 192 blacklist('_ image gen_platf inc12.png') 193 blacklist('_ image gen_platf inc13.png') 194 blacklist('_ image gen_platf inc14.png') 195 196 # WIC fails on questionable bmps and arithmetic jpegs 197 if 'Win' in bot: 198 blacklist('_ image gen_platf rle8-height-negative.bmp') 199 blacklist('_ image gen_platf rle4-height-negative.bmp') 200 blacklist('_ image gen_platf pal8os2v2.bmp') 201 blacklist('_ image gen_platf pal8os2v2-16.bmp') 202 blacklist('_ image gen_platf rgba32abf.bmp') 203 blacklist('_ image gen_platf rgb24prof.bmp') 204 blacklist('_ image gen_platf rgb24lprof.bmp') 205 blacklist('_ image gen_platf 8bpp-pixeldata-cropped.bmp') 206 blacklist('_ image gen_platf 4bpp-pixeldata-cropped.bmp') 207 blacklist('_ image gen_platf 32bpp-pixeldata-cropped.bmp') 208 blacklist('_ image gen_platf 24bpp-pixeldata-cropped.bmp') 209 blacklist('_ image gen_platf testimgari.jpg') 210 if 'x86_64' in bot and 'CPU' in bot: 211 # This GM triggers a SkSmallAllocator assert. 212 blacklist('_ gm _ composeshader_bitmap') 213 214 if 'Android' in bot or 'iOS' in bot: 215 # This test crashes the N9 (perhaps because of large malloc/frees). It also 216 # is fairly slow and not platform-specific. So we just disable it on all of 217 # Android and iOS. skia:5438 218 blacklist('_ test _ GrShape') 219 220 if 'Win8' in bot: 221 # bungeman: "Doesn't work on Windows anyway, produces unstable GMs with 222 # 'Unexpected error' from DirectWrite" 223 blacklist('_ gm _ fontscalerdistortable') 224 # skia:5636 225 blacklist('_ svg _ Nebraska-StateSeal.svg') 226 227 # skia:4095 228 bad_serialize_gms = ['bleed_image', 229 'c_gms', 230 'colortype', 231 'colortype_xfermodes', 232 'drawfilter', 233 'fontmgr_bounds_0.75_0', 234 'fontmgr_bounds_1_-0.25', 235 'fontmgr_bounds', 236 'fontmgr_match', 237 'fontmgr_iter', 238 'imagemasksubset'] 239 240 # skia:5589 241 bad_serialize_gms.extend(['bitmapfilters', 242 'bitmapshaders', 243 'bleed', 244 'bleed_alpha_bmp', 245 'bleed_alpha_bmp_shader', 246 'convex_poly_clip', 247 'extractalpha', 248 'filterbitmap_checkerboard_32_32_g8', 249 'filterbitmap_image_mandrill_64', 250 'shadows', 251 'simpleaaclip_aaclip']) 252 # skia:5595 253 bad_serialize_gms.extend(['composeshader_bitmap', 254 'scaled_tilemodes_npot', 255 'scaled_tilemodes']) 256 257 # skia:5778 258 bad_serialize_gms.append('typefacerendering_pfaMac') 259 # skia:5942 260 bad_serialize_gms.append('parsedpaths') 261 262 # these use a custom image generator which doesn't serialize 263 bad_serialize_gms.append('ImageGeneratorExternal_rect') 264 bad_serialize_gms.append('ImageGeneratorExternal_shader') 265 266 # skia:6189 267 bad_serialize_gms.append('shadow_utils') 268 269 for test in bad_serialize_gms: 270 blacklist(['serialize-8888', 'gm', '_', test]) 271 272 if 'Mac' not in bot: 273 for test in ['bleed_alpha_image', 'bleed_alpha_image_shader']: 274 blacklist(['serialize-8888', 'gm', '_', test]) 275 # It looks like we skip these only for out-of-memory concerns. 276 if 'Win' in bot or 'Android' in bot: 277 for test in ['verylargebitmap', 'verylarge_picture_image']: 278 blacklist(['serialize-8888', 'gm', '_', test]) 279 280 # skia:4769 281 for test in ['drawfilter']: 282 blacklist([ 'sp-8888', 'gm', '_', test]) 283 blacklist([ 'pic-8888', 'gm', '_', test]) 284 blacklist(['2ndpic-8888', 'gm', '_', test]) 285 blacklist([ 'lite-8888', 'gm', '_', test]) 286 # skia:4703 287 for test in ['image-cacherator-from-picture', 288 'image-cacherator-from-raster', 289 'image-cacherator-from-ctable']: 290 blacklist([ 'sp-8888', 'gm', '_', test]) 291 blacklist([ 'pic-8888', 'gm', '_', test]) 292 blacklist([ '2ndpic-8888', 'gm', '_', test]) 293 blacklist(['serialize-8888', 'gm', '_', test]) 294 295 # GM that requires raster-backed canvas 296 for test in ['gamut', 'complexclip4_bw', 'complexclip4_aa']: 297 blacklist([ 'sp-8888', 'gm', '_', test]) 298 blacklist([ 'pic-8888', 'gm', '_', test]) 299 blacklist([ 'lite-8888', 'gm', '_', test]) 300 blacklist([ '2ndpic-8888', 'gm', '_', test]) 301 blacklist(['serialize-8888', 'gm', '_', test]) 302 303 # GM that not support tiles_rt 304 for test in ['complexclip4_bw', 'complexclip4_aa']: 305 blacklist([ 'tiles_rt-8888', 'gm', '_', test]) 306 307 # Extensions for RAW images 308 r = ["arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", 309 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW"] 310 311 # skbug.com/4888 312 # Blacklist RAW images (and a few large PNGs) on GPU bots 313 # until we can resolve failures. 314 # Also blacklisted on 32-bit Win2k8 for F16 OOM errors. 315 if 'GPU' in bot or ('Win2k8' in bot and 'x86-' in bot): 316 blacklist('_ image _ interlaced1.png') 317 blacklist('_ image _ interlaced2.png') 318 blacklist('_ image _ interlaced3.png') 319 for raw_ext in r: 320 blacklist('_ image _ .%s' % raw_ext) 321 322 # Large image that overwhelms older Mac bots 323 if 'MacMini4.1-GPU' in bot: 324 blacklist('_ image _ abnormal.wbmp') 325 blacklist([gl_prefix + 'msaa' + sample_count, 'gm', '_', 'blurcircles']) 326 327 if 'IntelHD405' in bot and 'Ubuntu16' in bot: 328 # skia:6331 329 blacklist(['glmsaa8', 'image', 'gen_codec_gpu', 'abnormal.wbmp']) 330 blacklist(['glesmsaa4', 'image', 'gen_codec_gpu', 'abnormal.wbmp']) 331 332 if 'Nexus5' in bot: 333 # skia:5876 334 blacklist(['_', 'gm', '_', 'encode-platform']) 335 336 if 'AndroidOne-GPU' in bot: # skia:4697, skia:4704, skia:4694, skia:4705 337 blacklist(['_', 'gm', '_', 'bigblurs']) 338 blacklist(['_', 'gm', '_', 'bleed']) 339 blacklist(['_', 'gm', '_', 'bleed_alpha_bmp']) 340 blacklist(['_', 'gm', '_', 'bleed_alpha_bmp_shader']) 341 blacklist(['_', 'gm', '_', 'bleed_alpha_image']) 342 blacklist(['_', 'gm', '_', 'bleed_alpha_image_shader']) 343 blacklist(['_', 'gm', '_', 'bleed_image']) 344 blacklist(['_', 'gm', '_', 'dropshadowimagefilter']) 345 blacklist(['_', 'gm', '_', 'filterfastbounds']) 346 blacklist([gl_prefix, 'gm', '_', 'imageblurtiled']) 347 blacklist(['_', 'gm', '_', 'imagefiltersclipped']) 348 blacklist(['_', 'gm', '_', 'imagefiltersscaled']) 349 blacklist(['_', 'gm', '_', 'imageresizetiled']) 350 blacklist(['_', 'gm', '_', 'matrixconvolution']) 351 blacklist(['_', 'gm', '_', 'strokedlines']) 352 if sample_count is not '': 353 gl_msaa_config = gl_prefix + 'msaa' + sample_count 354 blacklist([gl_msaa_config, 'gm', '_', 'imageblurtiled']) 355 blacklist([gl_msaa_config, 'gm', '_', 'imagefiltersbase']) 356 357 match = [] 358 if 'Valgrind' in bot: # skia:3021 359 match.append('~Threaded') 360 361 if 'AndroidOne' in bot: # skia:4711 362 match.append('~WritePixels') 363 364 if 'NexusPlayer' in bot: 365 match.append('~ResourceCache') 366 367 if 'Nexus10' in bot: 368 match.append('~CopySurface') # skia:5509 369 match.append('~SRGBReadWritePixels') # skia:6097 370 371 if 'GalaxyJ5' in bot: 372 match.append('~SRGBReadWritePixels') # skia:6097 373 374 if 'GalaxyS6' in bot: 375 match.append('~SpecialImage') # skia:6338 376 377 if 'GalaxyS7_G930A' in bot: 378 match.append('~WritePixels') # skia:6427 379 380 if 'ANGLE' in bot and 'Debug' in bot: 381 match.append('~GLPrograms') # skia:4717 382 383 if 'MSAN' in bot: 384 match.extend(['~Once', '~Shared']) # Not sure what's up with these tests. 385 386 if 'TSAN' in bot: 387 match.extend(['~ReadWriteAlpha']) # Flaky on TSAN-covered on nvidia bots. 388 match.extend(['~RGBA4444TextureTest', # Flakier than they are important. 389 '~RGB565TextureTest']) 390 391 if 'Vulkan' in bot and 'Adreno' in bot: 392 # skia:5777 393 match.extend(['~XfermodeImageFilterCroppedInput', 394 '~GrTextureStripAtlasFlush', 395 '~CopySurface']) 396 397 if 'Vulkan' in bot and 'NexusPlayer' in bot: 398 match.extend(['~hardstop_gradient', # skia:6037 399 '~gradients_dup_color_stops', # skia:6037 400 '~gradients_no_texture$', # skia:6132 401 '~tilemodes', # skia:6132 402 '~shadertext$', # skia:6132 403 '~bitmapfilters', # skia:6132 404 '~GrContextFactory_abandon']) #skia:6209 405 406 if 'Vulkan' in bot and 'GTX1070' in bot and 'Win' in bot: 407 # skia:6092 408 match.append('~GPUMemorySize') 409 410 if 'Vulkan' in bot and 'IntelIris540' in bot and 'Ubuntu' in bot: 411 match.extend(['~VkHeapTests']) # skia:6245 412 413 if 'Vulkan' in bot and 'IntelIris540' in bot and 'Win' in bot: 414 # skia:6398 415 blacklist(['vk', 'gm', '_', 'aarectmodes']) 416 blacklist(['vk', 'gm', '_', 'aaxfermodes']) 417 blacklist(['vk', 'gm', '_', 'arithmode']) 418 blacklist(['vk', 'gm', '_', 'composeshader_bitmap']) 419 blacklist(['vk', 'gm', '_', 'composeshader_bitmap2']) 420 blacklist(['vk', 'gm', '_', 'dftextCOLR']) 421 blacklist(['vk', 'gm', '_', 'drawregionmodes']) 422 blacklist(['vk', 'gm', '_', 'filterfastbounds']) 423 blacklist(['vk', 'gm', '_', 'fontcache']) 424 blacklist(['vk', 'gm', '_', 'fontmgr_iterWin10']) 425 blacklist(['vk', 'gm', '_', 'fontmgr_iter_factoryWin10']) 426 blacklist(['vk', 'gm', '_', 'fontmgr_matchWin10']) 427 blacklist(['vk', 'gm', '_', 'fontscalerWin']) 428 blacklist(['vk', 'gm', '_', 'fontscalerdistortable']) 429 blacklist(['vk', 'gm', '_', 'gammagradienttext']) 430 blacklist(['vk', 'gm', '_', 'gammatextWin']) 431 blacklist(['vk', 'gm', '_', 'gradtext']) 432 blacklist(['vk', 'gm', '_', 'hairmodes']) 433 blacklist(['vk', 'gm', '_', 'imagefilters_xfermodes']) 434 blacklist(['vk', 'gm', '_', 'imagefiltersclipped']) 435 blacklist(['vk', 'gm', '_', 'imagefiltersgraph']) 436 blacklist(['vk', 'gm', '_', 'imagefiltersscaled']) 437 blacklist(['vk', 'gm', '_', 'imagefiltersstroked']) 438 blacklist(['vk', 'gm', '_', 'imagefilterstransformed']) 439 blacklist(['vk', 'gm', '_', 'imageresizetiled']) 440 blacklist(['vk', 'gm', '_', 'lcdblendmodes']) 441 blacklist(['vk', 'gm', '_', 'lcdoverlap']) 442 blacklist(['vk', 'gm', '_', 'lcdtextWin']) 443 blacklist(['vk', 'gm', '_', 'lcdtextsize']) 444 blacklist(['vk', 'gm', '_', 'matriximagefilter']) 445 blacklist(['vk', 'gm', '_', 'mixedtextblobsCOLR']) 446 blacklist(['vk', 'gm', '_', 'pictureimagefilter']) 447 blacklist(['vk', 'gm', '_', 'resizeimagefilter']) 448 blacklist(['vk', 'gm', '_', 'rotate_imagefilter']) 449 blacklist(['vk', 'gm', '_', 'savelayer_lcdtext']) 450 blacklist(['vk', 'gm', '_', 'srcmode']) 451 blacklist(['vk', 'gm', '_', 'surfaceprops']) 452 blacklist(['vk', 'gm', '_', 'textblobgeometrychange']) 453 blacklist(['vk', 'gm', '_', 'textbloblooper']) 454 blacklist(['vk', 'gm', '_', 'textblobmixedsizes']) 455 blacklist(['vk', 'gm', '_', 'textblobmixedsizes_df']) 456 blacklist(['vk', 'gm', '_', 'textblobrandomfont']) 457 blacklist(['vk', 'gm', '_', 'textfilter_color']) 458 blacklist(['vk', 'gm', '_', 'textfilter_image']) 459 blacklist(['vk', 'gm', '_', 'typefacerenderingWin']) 460 blacklist(['vk', 'gm', '_', 'varied_text_clipped_lcd']) 461 blacklist(['vk', 'gm', '_', 'varied_text_ignorable_clip_lcd']) 462 blacklist(['vk', 'gm', '_', 'xfermodeimagefilter']) 463 match.append('~ApplyGamma') 464 match.append('~ComposedImageFilterBounds_Gpu') 465 match.append('~ImageFilterFailAffectsTransparentBlack_Gpu') 466 match.append('~ImageFilterZeroBlurSigma_Gpu') 467 match.append('~ImageNewShader_GPU') 468 match.append('~NewTextureFromPixmap') 469 match.append('~ReadPixels_Gpu') 470 match.append('~ReadPixels_Texture') 471 match.append('~ReadWriteAlpha') 472 match.append('~SRGBReadWritePixels') 473 match.append('~SpecialImage_DeferredGpu') 474 match.append('~SpecialImage_Gpu') 475 match.append('~WritePixels_Gpu') 476 match.append('~XfermodeImageFilterCroppedInput_Gpu') 477 478 if 'IntelIris540' in bot and 'ANGLE' in bot: 479 match.append('~IntTexture') # skia:6086 480 blacklist(['_', 'gm', '_', 'discard']) # skia:6141 481 # skia:6103 482 for config in ['angle_d3d9_es2', 'angle_d3d11_es2', 'angle_gl_es2']: 483 blacklist([config, 'gm', '_', 'multipicturedraw_invpathclip_simple']) 484 blacklist([config, 'gm', '_', 'multipicturedraw_noclip_simple']) 485 blacklist([config, 'gm', '_', 'multipicturedraw_pathclip_simple']) 486 blacklist([config, 'gm', '_', 'multipicturedraw_rectclip_simple']) 487 blacklist([config, 'gm', '_', 'multipicturedraw_rrectclip_simple']) 488 489 if 'IntelBayTrail' in bot and 'Ubuntu' in bot: 490 match.append('~ImageStorageLoad') # skia:6358 491 492 if 'Vivante' in bot: 493 # This causes the bot to spin for >3.5 hours. 494 blacklist(['_', 'gm', '_', 'scaled_tilemodes_npot']) 495 496 if blacklisted: 497 args.append('--blacklist') 498 args.extend(blacklisted) 499 500 if match: 501 args.append('--match') 502 args.extend(match) 503 504 # These bots run out of memory running RAW codec tests. Do not run them in 505 # parallel 506 if ('NexusPlayer' in bot or 'Nexus5' in bot or 'Nexus9' in bot 507 or 'Win8-MSVC-ShuttleB' in bot): 508 args.append('--noRAW_threading') 509 510 return args 511 512 513def key_params(api): 514 """Build a unique key from the builder name (as a list). 515 516 E.g. arch x86 gpu GeForce320M mode MacMini4.1 os Mac10.6 517 """ 518 # Don't bother to include role, which is always Test. 519 # TryBots are uploaded elsewhere so they can use the same key. 520 blacklist = ['role', 'is_trybot'] 521 522 flat = [] 523 for k in sorted(api.vars.builder_cfg.keys()): 524 if k not in blacklist: 525 flat.append(k) 526 flat.append(api.vars.builder_cfg[k]) 527 return flat 528 529 530def test_steps(api): 531 """Run the DM test.""" 532 use_hash_file = False 533 if api.vars.upload_dm_results: 534 # This must run before we write anything into 535 # api.flavor.device_dirs.dm_dir or we may end up deleting our 536 # output on machines where they're the same. 537 api.flavor.create_clean_host_dir(api.vars.dm_dir) 538 host_dm_dir = str(api.vars.dm_dir) 539 device_dm_dir = str(api.flavor.device_dirs.dm_dir) 540 if host_dm_dir != device_dm_dir: 541 api.flavor.create_clean_device_dir(device_dm_dir) 542 543 # Obtain the list of already-generated hashes. 544 hash_filename = 'uninteresting_hashes.txt' 545 546 # Ensure that the tmp_dir exists. 547 api.run.run_once(api.file.makedirs, 548 'tmp_dir', 549 api.vars.tmp_dir, 550 infra_step=True) 551 552 host_hashes_file = api.vars.tmp_dir.join(hash_filename) 553 hashes_file = api.flavor.device_path_join( 554 api.flavor.device_dirs.tmp_dir, hash_filename) 555 api.run( 556 api.python.inline, 557 'get uninteresting hashes', 558 program=""" 559 import contextlib 560 import math 561 import socket 562 import sys 563 import time 564 import urllib2 565 566 HASHES_URL = 'https://gold.skia.org/_/hashes' 567 RETRIES = 5 568 TIMEOUT = 60 569 WAIT_BASE = 15 570 571 socket.setdefaulttimeout(TIMEOUT) 572 for retry in range(RETRIES): 573 try: 574 with contextlib.closing( 575 urllib2.urlopen(HASHES_URL, timeout=TIMEOUT)) as w: 576 hashes = w.read() 577 with open(sys.argv[1], 'w') as f: 578 f.write(hashes) 579 break 580 except Exception as e: 581 print 'Failed to get uninteresting hashes from %s:' % HASHES_URL 582 print e 583 if retry == RETRIES: 584 raise 585 waittime = WAIT_BASE * math.pow(2, retry) 586 print 'Retry in %d seconds.' % waittime 587 time.sleep(waittime) 588 """, 589 args=[host_hashes_file], 590 abort_on_failure=False, 591 fail_build_on_failure=False, 592 infra_step=True) 593 594 if api.path.exists(host_hashes_file): 595 api.flavor.copy_file_to_device(host_hashes_file, hashes_file) 596 use_hash_file = True 597 598 # Run DM. 599 properties = [ 600 'gitHash', api.vars.got_revision, 601 'master', api.vars.master_name, 602 'builder', api.vars.builder_name, 603 'build_number', api.vars.build_number, 604 ] 605 if api.vars.is_trybot: 606 properties.extend([ 607 'issue', api.vars.issue, 608 'patchset', api.vars.patchset, 609 'patch_storage', api.vars.patch_storage, 610 ]) 611 if api.vars.no_buildbot: 612 properties.extend(['no_buildbot', 'True']) 613 properties.extend(['swarming_bot_id', api.vars.swarming_bot_id]) 614 properties.extend(['swarming_task_id', api.vars.swarming_task_id]) 615 616 args = [ 617 'dm', 618 '--undefok', # This helps branches that may not know new flags. 619 '--resourcePath', api.flavor.device_dirs.resource_dir, 620 '--skps', api.flavor.device_dirs.skp_dir, 621 '--images', api.flavor.device_path_join( 622 api.flavor.device_dirs.images_dir, 'dm'), 623 '--colorImages', api.flavor.device_path_join( 624 api.flavor.device_dirs.images_dir, 'colorspace'), 625 '--nameByHash', 626 '--properties' 627 ] + properties 628 629 args.extend(['--svgs', api.flavor.device_dirs.svg_dir]) 630 631 args.append('--key') 632 args.extend(key_params(api)) 633 if use_hash_file: 634 args.extend(['--uninterestingHashesFile', hashes_file]) 635 if api.vars.upload_dm_results: 636 args.extend(['--writePath', api.flavor.device_dirs.dm_dir]) 637 638 skip_flag = None 639 if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU': 640 skip_flag = '--nogpu' 641 elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU': 642 skip_flag = '--nocpu' 643 if skip_flag: 644 args.append(skip_flag) 645 args.extend(dm_flags(api.vars.builder_name)) 646 647 env = api.step.get_from_context('env', {}) 648 if 'Ubuntu16' in api.vars.builder_name: 649 # The vulkan in this asset name simply means that the graphics driver 650 # supports Vulkan. It is also the driver used for GL code. 651 dri_path = api.vars.slave_dir.join('linux_vulkan_intel_driver_release') 652 if 'Debug' in api.vars.builder_name: 653 dri_path = api.vars.slave_dir.join('linux_vulkan_intel_driver_debug') 654 655 if 'Vulkan' in api.vars.builder_name: 656 sdk_path = api.vars.slave_dir.join('linux_vulkan_sdk', 'bin') 657 lib_path = api.vars.slave_dir.join('linux_vulkan_sdk', 'lib') 658 env.update({ 659 'PATH':'%%(PATH)s:%s' % sdk_path, 660 'LD_LIBRARY_PATH': '%s:%s' % (lib_path, dri_path), 661 'LIBGL_DRIVERS_PATH': dri_path, 662 'VK_ICD_FILENAMES':'%s' % dri_path.join('intel_icd.x86_64.json'), 663 }) 664 else: 665 # Even the non-vulkan NUC jobs could benefit from the newer drivers. 666 env.update({ 667 'LD_LIBRARY_PATH': dri_path, 668 'LIBGL_DRIVERS_PATH': dri_path, 669 }) 670 671 # See skia:2789. 672 if '_AbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''): 673 args.append('--abandonGpuContext') 674 if '_PreAbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''): 675 args.append('--preAbandonGpuContext') 676 677 with api.step.context({'env': env}): 678 api.run(api.flavor.step, 'dm', cmd=args, abort_on_failure=False) 679 680 if api.vars.upload_dm_results: 681 # Copy images and JSON to host machine if needed. 682 api.flavor.copy_directory_contents_to_host( 683 api.flavor.device_dirs.dm_dir, api.vars.dm_dir) 684 685 686class TestApi(recipe_api.RecipeApi): 687 def run(self): 688 self.m.core.setup() 689 env = self.m.step.get_from_context('env', {}) 690 if 'iOS' in self.m.vars.builder_name: 691 env['IOS_BUNDLE_ID'] = 'com.google.dm' 692 with self.m.step.context({'env': env}): 693 try: 694 self.m.flavor.install_everything() 695 test_steps(self.m) 696 finally: 697 self.m.flavor.cleanup_steps() 698 self.m.run.check_failure() 699