• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2020 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
5package gen_tasks_logic
6
7import (
8	"fmt"
9	"log"
10	"sort"
11	"strconv"
12	"strings"
13
14	"github.com/golang/glog"
15	"go.skia.org/infra/task_scheduler/go/specs"
16)
17
18// keyParams generates the key used by DM for Gold results.
19func keyParams(parts map[string]string) []string {
20	// Don't bother to include role, which is always Test.
21	ignored := []string{"role", "test_filter"}
22	keys := make([]string, 0, len(parts))
23	for key := range parts {
24		found := false
25		for _, b := range ignored {
26			if key == b {
27				found = true
28				break
29			}
30		}
31		if !found {
32			keys = append(keys, key)
33		}
34	}
35	sort.Strings(keys)
36	rv := make([]string, 0, 2*len(keys))
37	for _, key := range keys {
38		rv = append(rv, key, parts[key])
39	}
40	return rv
41}
42
43// dmFlags generates flags to DM based on the given task properties.
44func (b *taskBuilder) dmFlags(internalHardwareLabel string) {
45	properties := map[string]string{
46		"gitHash":              specs.PLACEHOLDER_REVISION,
47		"builder":              b.Name,
48		"buildbucket_build_id": specs.PLACEHOLDER_BUILDBUCKET_BUILD_ID,
49		"task_id":              specs.PLACEHOLDER_TASK_ID,
50		"issue":                specs.PLACEHOLDER_ISSUE,
51		"patchset":             specs.PLACEHOLDER_PATCHSET,
52		"patch_storage":        specs.PLACEHOLDER_PATCH_STORAGE,
53		"swarming_bot_id":      "${SWARMING_BOT_ID}",
54		"swarming_task_id":     "${SWARMING_TASK_ID}",
55	}
56
57	args := []string{
58		"dm",
59		"--nameByHash",
60	}
61
62	configs := []string{}
63	skipped := []string{}
64
65	hasConfig := func(cfg string) bool {
66		for _, c := range configs {
67			if c == cfg {
68				return true
69			}
70		}
71		return false
72	}
73	filter := func(slice []string, elems ...string) []string {
74		m := make(map[string]bool, len(elems))
75		for _, e := range elems {
76			m[e] = true
77		}
78		rv := make([]string, 0, len(slice))
79		for _, e := range slice {
80			if m[e] {
81				rv = append(rv, e)
82			}
83		}
84		return rv
85	}
86	remove := func(slice []string, elem string) []string {
87		rv := make([]string, 0, len(slice))
88		for _, e := range slice {
89			if e != elem {
90				rv = append(rv, e)
91			}
92		}
93		return rv
94	}
95	removeContains := func(slice []string, elem string) []string {
96		rv := make([]string, 0, len(slice))
97		for _, e := range slice {
98			if !strings.Contains(e, elem) {
99				rv = append(rv, e)
100			}
101		}
102		return rv
103	}
104	suffix := func(slice []string, sfx string) []string {
105		rv := make([]string, 0, len(slice))
106		for _, e := range slice {
107			rv = append(rv, e+sfx)
108		}
109		return rv
110	}
111
112	skip := func(quad ...string) {
113		if len(quad) == 1 {
114			quad = strings.Fields(quad[0])
115		}
116		if len(quad) != 4 {
117			log.Fatalf("Invalid value for --skip: %+v", quad)
118		}
119		config := quad[0]
120		src := quad[1]
121		options := quad[2]
122		name := quad[3]
123		if config == "_" ||
124			hasConfig(config) ||
125			(config[0] == '~' && hasConfig(config[1:])) {
126			skipped = append(skipped, config, src, options, name)
127		}
128	}
129
130	// Keys.
131	keys := keyParams(b.parts)
132	if b.extraConfig("Lottie") {
133		keys = append(keys, "renderer", "skottie")
134	}
135	if b.matchExtraConfig("DDL") {
136		// 'DDL' style means "--skpViewportSize 2048"
137		keys = append(keys, "style", "DDL")
138	} else {
139		keys = append(keys, "style", "default")
140	}
141	args = append(args, "--key")
142	args = append(args, keys...)
143
144	// This enables non-deterministic random seeding of the GPU FP optimization
145	// test.
146	// Not Android due to:
147	//  - https://skia.googlesource.com/skia/+/5910ed347a638ded8cd4c06dbfda086695df1112/BUILD.gn#160
148	//  - https://skia.googlesource.com/skia/+/ce06e261e68848ae21cac1052abc16bc07b961bf/tests/ProcessorTest.cpp#307
149	// Not MSAN due to:
150	//  - https://skia.googlesource.com/skia/+/0ac06e47269a40c177747310a613d213c95d1d6d/infra/bots/recipe_modules/flavor/gn_flavor.py#80
151	if !b.os("Android") && !b.extraConfig("MSAN") {
152		args = append(args, "--randomProcessorTest")
153	}
154
155	threadLimit := -1
156	const MAIN_THREAD_ONLY = 0
157
158	// 32-bit desktop bots tend to run out of memory, because they have relatively
159	// far more cores than RAM (e.g. 32 cores, 3G RAM).  Hold them back a bit.
160	if b.arch("x86") {
161		threadLimit = 4
162	}
163
164	// These bots run out of memory easily.
165	if b.model("MotoG4", "Nexus7") {
166		threadLimit = MAIN_THREAD_ONLY
167	}
168
169	// Avoid issues with dynamically exceeding resource cache limits.
170	if b.matchExtraConfig("DISCARDABLE") {
171		threadLimit = MAIN_THREAD_ONLY
172	}
173
174	if threadLimit >= 0 {
175		args = append(args, "--threads", strconv.Itoa(threadLimit))
176	}
177
178	sampleCount := 0
179	glPrefix := ""
180	if b.extraConfig("SwiftShader") {
181		configs = append(configs, "gles", "glesdft")
182		args = append(args, "--disableDriverCorrectnessWorkarounds")
183	} else if b.cpu() {
184		args = append(args, "--nogpu")
185
186		configs = append(configs, "8888")
187
188		if b.extraConfig("SkVM") {
189			args = append(args, "--skvm")
190		}
191
192		if b.extraConfig("BonusConfigs") {
193			configs = []string{
194				"g8", "565",
195				"pic-8888", "serialize-8888",
196				"f16", "srgb", "esrgb", "narrow", "enarrow",
197				"p3", "ep3", "rec2020", "erec2020"}
198		}
199
200		if b.extraConfig("PDF") {
201			configs = []string{"pdf"}
202			args = append(args, "--rasterize_pdf") // Works only on Mac.
203			// Take ~forever to rasterize:
204			skip("pdf gm _ lattice2")
205			skip("pdf gm _ hairmodes")
206			skip("pdf gm _ longpathdash")
207		}
208
209	} else if b.gpu() {
210		args = append(args, "--nocpu")
211
212		// Add in either gles or gl configs to the canonical set based on OS
213		glPrefix = "gl"
214		// Use 4x MSAA for all our testing. It's more consistent and 8x MSAA is nondeterministic (by
215		// design) on NVIDIA hardware. The problem is especially bad on ANGLE.  skia:6813 skia:6545
216		sampleCount = 4
217		if b.os("Android", "iOS") {
218			glPrefix = "gles"
219			// MSAA is disabled on Pixel3a (https://b.corp.google.com/issues/143074513).
220			// MSAA is disabled on Pixel5 (https://skbug.com/11152).
221			if b.model("Pixel3a", "Pixel5") {
222				sampleCount = 0
223			}
224		} else if b.matchGpu("Intel") {
225			// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926
226			sampleCount = 0
227		} else if b.os("ChromeOS") {
228			glPrefix = "gles"
229		}
230
231		if b.extraConfig("NativeFonts") {
232			configs = append(configs, glPrefix)
233		} else {
234			configs = append(configs, glPrefix, glPrefix+"dft", glPrefix+"srgb")
235			if sampleCount > 0 {
236				configs = append(configs, fmt.Sprintf("%smsaa%d", glPrefix, sampleCount))
237			}
238		}
239
240		// The Tegra3 doesn't support MSAA
241		if b.gpu("Tegra3") ||
242			// We aren't interested in fixing msaa bugs on current iOS devices.
243			b.model("iPad4", "iPadPro", "iPhone6", "iPhone7") ||
244			// skia:5792
245			b.gpu("IntelHD530", "IntelIris540") {
246			configs = removeContains(configs, "msaa")
247		}
248
249		// We want to test both the OpenGL config and the GLES config on Linux Intel:
250		// GL is used by Chrome, GLES is used by ChromeOS.
251		// Also do the Ganesh threading verification test (render with and without
252		// worker threads, using only the SW path renderer, and compare the results).
253		if b.matchGpu("Intel") && b.isLinux() {
254			configs = append(configs, "gles", "glesdft", "glessrgb", "gltestthreading")
255			// skbug.com/6333, skbug.com/6419, skbug.com/6702
256			skip("gltestthreading gm _ lcdblendmodes")
257			skip("gltestthreading gm _ lcdoverlap")
258			skip("gltestthreading gm _ textbloblooper")
259			// All of these GMs are flaky, too:
260			skip("gltestthreading gm _ savelayer_with_backdrop")
261			skip("gltestthreading gm _ persp_shaders_bw")
262			skip("gltestthreading gm _ dftext_blob_persp")
263			skip("gltestthreading gm _ dftext")
264			skip("gltestthreading gm _ gpu_blur_utils")
265			skip("gltestthreading gm _ gpu_blur_utils_ref")
266			skip("gltestthreading gm _ gpu_blur_utils_subset_rect")
267			skip("gltestthreading gm _ gpu_blur_utils_subset_rect_ref")
268			// skbug.com/7523 - Flaky on various GPUs
269			skip("gltestthreading gm _ orientation")
270			// These GMs only differ in the low bits
271			skip("gltestthreading gm _ stroketext")
272			skip("gltestthreading gm _ draw_image_set")
273		}
274
275		// CommandBuffer bot *only* runs the command_buffer config.
276		if b.extraConfig("CommandBuffer") {
277			configs = []string{"commandbuffer"}
278		}
279
280		// Dawn bot *only* runs the dawn config
281		if b.extraConfig("Dawn") {
282			configs = []string{"dawn"}
283		}
284
285		// ANGLE bot *only* runs the angle configs
286		if b.extraConfig("ANGLE") {
287			configs = []string{"angle_d3d11_es2",
288				"angle_gl_es2",
289				"angle_d3d11_es3"}
290			if sampleCount > 0 {
291				configs = append(configs, fmt.Sprintf("angle_d3d11_es2_msaa%d", sampleCount))
292				configs = append(configs, fmt.Sprintf("angle_d3d11_es3_msaa%d", sampleCount))
293			}
294			if b.matchGpu("GTX", "Quadro") {
295				// See skia:7823 and chromium:693090.
296				configs = append(configs, "angle_gl_es3")
297				if sampleCount > 0 {
298					configs = append(configs, fmt.Sprintf("angle_gl_es2_msaa%d", sampleCount))
299					configs = append(configs, fmt.Sprintf("angle_gl_es3_msaa%d", sampleCount))
300				}
301			}
302			if !b.matchGpu("GTX", "Quadro", "GT610") {
303				// See skia:10149
304				configs = append(configs, "angle_d3d9_es2")
305			}
306			if b.model("NUC5i7RYH") {
307				// skbug.com/7376
308				skip("_ test _ ProcessorCloneTest")
309			}
310		}
311
312		if b.model("AndroidOne", "GalaxyS6", "Nexus5", "Nexus7") {
313			// skbug.com/9019
314			skip("_ test _ ProcessorCloneTest")
315			skip("_ test _ Programs")
316			skip("_ test _ ProcessorOptimizationValidationTest")
317		}
318
319		if b.model("GalaxyS20") {
320			// skbug.com/10595
321			skip("_ test _ ProcessorCloneTest")
322		}
323
324		if b.extraConfig("CommandBuffer") && b.model("MacBook10.1") {
325			// skbug.com/9235
326			skip("_ test _ Programs")
327		}
328
329		if b.extraConfig("CommandBuffer") {
330			// skbug.com/10412
331			skip("_ test _ GLBackendAllocationTest")
332		}
333
334		// skbug.com/9043 - these devices render this test incorrectly
335		// when opList splitting reduction is enabled
336		if b.gpu() && b.extraConfig("Vulkan") && (b.gpu("RadeonR9M470X", "RadeonHD7770")) {
337			skip("_", "tests", "_", "VkDrawableImportTest")
338		}
339		if b.extraConfig("Vulkan") {
340			configs = []string{"vk"}
341			// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926, skia:9023
342			if !b.matchGpu("Intel") {
343				configs = append(configs, "vkmsaa4")
344			}
345		}
346		if b.extraConfig("Metal") {
347			configs = []string{"mtl"}
348			// MSAA doesn't work well on Intel GPUs chromium:527565, chromium:983926
349			if !b.matchGpu("Intel") {
350				configs = append(configs, "mtlmsaa4")
351			}
352		}
353		if b.extraConfig("Direct3D") {
354			configs = []string{"d3d"}
355		}
356
357		// Test 1010102 on our Linux/NVIDIA bots and the persistent cache config
358		// on the GL bots.
359		if b.gpu("QuadroP400") && !b.extraConfig("PreAbandonGpuContext") && !b.extraConfig("TSAN") && b.isLinux() {
360			if b.extraConfig("Vulkan") {
361				configs = append(configs, "vk1010102")
362				// Decoding transparent images to 1010102 just looks bad
363				skip("vk1010102 image _ _")
364			} else {
365				configs = append(configs, "gl1010102", "gltestpersistentcache", "gltestglslcache", "gltestprecompile")
366				// Decoding transparent images to 1010102 just looks bad
367				skip("gl1010102 image _ _")
368				// These tests produce slightly different pixels run to run on NV.
369				skip("gltestpersistentcache gm _ atlastext")
370				skip("gltestpersistentcache gm _ dftext")
371				skip("gltestpersistentcache gm _ glyph_pos_h_b")
372				skip("gltestpersistentcache gm _ glyph_pos_h_f")
373				skip("gltestpersistentcache gm _ glyph_pos_n_f")
374				skip("gltestglslcache gm _ atlastext")
375				skip("gltestglslcache gm _ dftext")
376				skip("gltestglslcache gm _ glyph_pos_h_b")
377				skip("gltestglslcache gm _ glyph_pos_h_f")
378				skip("gltestglslcache gm _ glyph_pos_n_f")
379				skip("gltestprecompile gm _ atlastext")
380				skip("gltestprecompile gm _ dftext")
381				skip("gltestprecompile gm _ glyph_pos_h_b")
382				skip("gltestprecompile gm _ glyph_pos_h_f")
383				skip("gltestprecompile gm _ glyph_pos_n_f")
384				// Tessellation shaders do not yet participate in the persistent cache.
385				skip("gltestpersistentcache gm _ tessellation")
386				skip("gltestglslcache gm _ tessellation")
387				skip("gltestprecompile gm _ tessellation")
388			}
389		}
390
391		// We also test the SkSL precompile config on Pixel2XL as a representative
392		// Android device - this feature is primarily used by Flutter.
393		if b.model("Pixel2XL") && !b.extraConfig("Vulkan") {
394			configs = append(configs, "glestestprecompile")
395		}
396
397		// Test SkSL precompile on iPhone 8 as representative iOS device
398		if b.model("iPhone8") && b.extraConfig("Metal") {
399			configs = append(configs, "mtltestprecompile")
400			// avoid tests that can generate slightly different pixels per run
401			skip("mtltestprecompile gm _ atlastext")
402			skip("mtltestprecompile gm _ circular_arcs_hairline")
403			skip("mtltestprecompile gm _ dftext")
404			skip("mtltestprecompile gm _ fontmgr_bounds_1_-0.25")
405			skip("mtltestprecompile gm _ glyph_pos_h_b")
406			skip("mtltestprecompile gm _ glyph_pos_h_f")
407			skip("mtltestprecompile gm _ glyph_pos_n_f")
408			skip("mtltestprecompile gm _ strokes3")
409			skip("mtltestprecompile gm _ texel_subset_linear_mipmap_nearest_down")
410			skip("mtltestprecompile gm _ texel_subset_linear_mipmap_linear_down")
411			skip("mtltestprecompile svg _ A_large_blank_world_map_with_oceans_marked_in_blue.svg")
412			skip("mtltestprecompile svg _ Chalkboard.svg")
413			skip("mtltestprecompile svg _ Ghostscript_Tiger.svg")
414		}
415		// Test reduced shader mode on iPhone 11 as representative iOS device
416		if b.model("iPhone11") && b.extraConfig("Metal") {
417			configs = append(configs, "mtlreducedshaders")
418		}
419
420		if b.gpu("AppleM1") && !b.extraConfig("Metal") {
421			skip("_ test _ TransferPixelsFromTextureTest") // skia:11814
422		}
423
424		if b.model(DONT_REDUCE_OPS_TASK_SPLITTING_MODELS...) {
425			args = append(args, "--dontReduceOpsTaskSplitting", "true")
426		}
427
428		// Test reduceOpsTaskSplitting fallback when over budget.
429		if b.model("NUC7i5BNK") && b.extraConfig("ASAN") {
430			args = append(args, "--gpuResourceCacheLimit", "16777216")
431		}
432
433		// Test rendering to wrapped dsts on a few bots
434		// Also test "glenarrow", which hits F16 surfaces and F16 vertex colors.
435		if b.extraConfig("BonusConfigs") {
436			configs = []string{"glbetex", "glbert", "glenarrow", "glreducedshaders"}
437		}
438
439		if b.os("ChromeOS") {
440			// Just run GLES for now - maybe add gles_msaa4 in the future
441			configs = []string{"gles"}
442		}
443
444		// Test GPU tessellation path renderer.
445		if b.extraConfig("GpuTess") {
446			configs = []string{glPrefix + "msaa4"}
447			args = append(args, "--hwtess", "--pr", "tess")
448		}
449
450		// Test dynamic MSAA.
451		if b.extraConfig("DMSAA") {
452			configs = []string{glPrefix + "dmsaa"}
453			if !b.os("Android") {
454				// Also enable hardware tessellation if not on android.
455				args = append(args, "--hwtess")
456			}
457		}
458
459		// DDL is a GPU-only feature
460		if b.extraConfig("DDL1") {
461			// This bot generates comparison images for the large skps and the gms
462			configs = filter(configs, "gl", "vk", "mtl")
463			args = append(args, "--skpViewportSize", "2048")
464		}
465		if b.extraConfig("DDL3") {
466			// This bot generates the real ddl images for the large skps and the gms
467			configs = suffix(filter(configs, "gl", "vk", "mtl"), "ddl")
468			args = append(args, "--skpViewportSize", "2048")
469			args = append(args, "--gpuThreads", "0")
470		}
471		if b.extraConfig("OOPRDDL") {
472			// This bot generates the real oopr/DDL images for the large skps and the GMs
473			configs = suffix(filter(configs, "gl", "vk", "mtl"), "ooprddl")
474			args = append(args, "--skpViewportSize", "2048")
475			args = append(args, "--gpuThreads", "0")
476		}
477	}
478
479	// Sharding.
480	tf := b.parts["test_filter"]
481	if tf != "" && tf != "All" {
482		// Expected format: shard_XX_YY
483		split := strings.Split(tf, "_")
484		if len(split) == 3 {
485			args = append(args, "--shard", split[1])
486			args = append(args, "--shards", split[2])
487		} else {
488			glog.Fatalf("Invalid task name - bad shards: %s", tf)
489		}
490	}
491
492	args = append(args, "--config")
493	args = append(args, configs...)
494
495	removeFromArgs := func(arg string) {
496		args = remove(args, arg)
497	}
498
499	// Run tests, gms, and image decoding tests everywhere.
500	args = append(args, "--src", "tests", "gm", "image", "lottie", "colorImage", "svg", "skp")
501	if b.gpu() {
502		// Don't run the "svgparse_*" svgs on GPU.
503		skip("_ svg _ svgparse_")
504	} else if b.Name == "Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN" {
505		// Only run the CPU SVGs on 8888.
506		skip("~8888 svg _ _")
507	} else {
508		// On CPU SVGs we only care about parsing. Only run them on the above bot.
509		removeFromArgs("svg")
510	}
511
512	// Eventually I'd like these to pass, but for now just skip 'em.
513	if b.extraConfig("SK_FORCE_RASTER_PIPELINE_BLITTER") {
514		removeFromArgs("tests")
515	}
516
517	if b.extraConfig("NativeFonts") { // images won't exercise native font integration :)
518		removeFromArgs("image")
519		removeFromArgs("colorImage")
520	}
521
522	if b.matchExtraConfig("DDL", "PDF") {
523		// The DDL and PDF bots just render the large skps and the gms
524		removeFromArgs("tests")
525		removeFromArgs("image")
526		removeFromArgs("colorImage")
527		removeFromArgs("svg")
528	} else {
529		// No other bots render the .skps.
530		removeFromArgs("skp")
531	}
532
533	if b.extraConfig("Lottie") {
534		// Only run the lotties on Lottie bots.
535		removeFromArgs("tests")
536		removeFromArgs("gm")
537		removeFromArgs("image")
538		removeFromArgs("colorImage")
539		removeFromArgs("svg")
540		removeFromArgs("skp")
541	} else {
542		removeFromArgs("lottie")
543	}
544
545	if b.extraConfig("TSAN") {
546		// skbug.com/10848
547		removeFromArgs("svg")
548	}
549
550	// TODO: ???
551	skip("f16 _ _ dstreadshuffle")
552	skip("glsrgb image _ _")
553	skip("glessrgb image _ _")
554
555	// --src image --config g8 means "decode into Gray8", which isn't supported.
556	skip("g8 image _ _")
557	skip("g8 colorImage _ _")
558
559	if b.extraConfig("Valgrind") {
560		// These take 18+ hours to run.
561		skip("pdf gm _ fontmgr_iter")
562		skip("pdf _ _ PANO_20121023_214540.jpg")
563		skip("pdf skp _ worldjournal")
564		skip("pdf skp _ desk_baidu.skp")
565		skip("pdf skp _ desk_wikipedia.skp")
566		skip("_ svg _ _")
567		// skbug.com/9171 and 8847
568		skip("_ test _ InitialTextureClear")
569	}
570
571	if b.model("Pixel3") {
572		// skbug.com/10546
573		skip("vkddl gm _ compressed_textures_nmof")
574		skip("vkddl gm _ compressed_textures_npot")
575		skip("vkddl gm _ compressed_textures")
576	}
577
578	if b.model("TecnoSpark3Pro") {
579		// skbug.com/9421
580		skip("_ test _ InitialTextureClear")
581	}
582
583	if b.os("iOS") {
584		skip(glPrefix + " skp _ _")
585	}
586
587	if b.matchOs("Mac", "iOS") {
588		// CG fails on questionable bmps
589		skip("_ image gen_platf rgba32abf.bmp")
590		skip("_ image gen_platf rgb24prof.bmp")
591		skip("_ image gen_platf rgb24lprof.bmp")
592		skip("_ image gen_platf 8bpp-pixeldata-cropped.bmp")
593		skip("_ image gen_platf 4bpp-pixeldata-cropped.bmp")
594		skip("_ image gen_platf 32bpp-pixeldata-cropped.bmp")
595		skip("_ image gen_platf 24bpp-pixeldata-cropped.bmp")
596
597		// CG has unpredictable behavior on this questionable gif
598		// It's probably using uninitialized memory
599		skip("_ image gen_platf frame_larger_than_image.gif")
600
601		// CG has unpredictable behavior on incomplete pngs
602		// skbug.com/5774
603		skip("_ image gen_platf inc0.png")
604		skip("_ image gen_platf inc1.png")
605		skip("_ image gen_platf inc2.png")
606		skip("_ image gen_platf inc3.png")
607		skip("_ image gen_platf inc4.png")
608		skip("_ image gen_platf inc5.png")
609		skip("_ image gen_platf inc6.png")
610		skip("_ image gen_platf inc7.png")
611		skip("_ image gen_platf inc8.png")
612		skip("_ image gen_platf inc9.png")
613		skip("_ image gen_platf inc10.png")
614		skip("_ image gen_platf inc11.png")
615		skip("_ image gen_platf inc12.png")
616		skip("_ image gen_platf inc13.png")
617		skip("_ image gen_platf inc14.png")
618		skip("_ image gen_platf incInterlaced.png")
619
620		// These images fail after Mac 10.13.1 upgrade.
621		skip("_ image gen_platf incInterlaced.gif")
622		skip("_ image gen_platf inc1.gif")
623		skip("_ image gen_platf inc0.gif")
624		skip("_ image gen_platf butterfly.gif")
625	}
626
627	// WIC fails on questionable bmps
628	if b.matchOs("Win") {
629		skip("_ image gen_platf pal8os2v2.bmp")
630		skip("_ image gen_platf pal8os2v2-16.bmp")
631		skip("_ image gen_platf rgba32abf.bmp")
632		skip("_ image gen_platf rgb24prof.bmp")
633		skip("_ image gen_platf rgb24lprof.bmp")
634		skip("_ image gen_platf 8bpp-pixeldata-cropped.bmp")
635		skip("_ image gen_platf 4bpp-pixeldata-cropped.bmp")
636		skip("_ image gen_platf 32bpp-pixeldata-cropped.bmp")
637		skip("_ image gen_platf 24bpp-pixeldata-cropped.bmp")
638		if b.arch("x86_64") && b.cpu() {
639			// This GM triggers a SkSmallAllocator assert.
640			skip("_ gm _ composeshader_bitmap")
641		}
642	}
643
644	if b.matchOs("Win", "Mac") {
645		// WIC and CG fail on arithmetic jpegs
646		skip("_ image gen_platf testimgari.jpg")
647		// More questionable bmps that fail on Mac, too. skbug.com/6984
648		skip("_ image gen_platf rle8-height-negative.bmp")
649		skip("_ image gen_platf rle4-height-negative.bmp")
650	}
651
652	// These PNGs have CRC errors. The platform generators seem to draw
653	// uninitialized memory without reporting an error, so skip them to
654	// avoid lots of images on Gold.
655	skip("_ image gen_platf error")
656
657	if b.os("Android", "iOS") {
658		// This test crashes the N9 (perhaps because of large malloc/frees). It also
659		// is fairly slow and not platform-specific. So we just disable it on all of
660		// Android and iOS. skia:5438
661		skip("_ test _ GrStyledShape")
662	}
663
664	if internalHardwareLabel == "5" {
665		// http://b/118312149#comment9
666		skip("_ test _ SRGBReadWritePixels")
667	}
668
669	// skia:4095
670	badSerializeGMs := []string{
671		"strict_constraint_batch_no_red_allowed", // https://crbug.com/skia/10278
672		"strict_constraint_no_red_allowed",       // https://crbug.com/skia/10278
673		"fast_constraint_red_is_allowed",         // https://crbug.com/skia/10278
674		"c_gms",
675		"colortype",
676		"colortype_xfermodes",
677		"drawfilter",
678		"fontmgr_bounds_0.75_0",
679		"fontmgr_bounds_1_-0.25",
680		"fontmgr_bounds",
681		"fontmgr_match",
682		"fontmgr_iter",
683		"imagemasksubset",
684		"wacky_yuv_formats_domain",
685		"imagemakewithfilter",
686		"imagemakewithfilter_crop",
687		"imagemakewithfilter_crop_ref",
688		"imagemakewithfilter_ref",
689	}
690
691	// skia:5589
692	badSerializeGMs = append(badSerializeGMs,
693		"bitmapfilters",
694		"bitmapshaders",
695		"convex_poly_clip",
696		"extractalpha",
697		"filterbitmap_checkerboard_32_32_g8",
698		"filterbitmap_image_mandrill_64",
699		"shadows",
700		"simpleaaclip_aaclip",
701	)
702
703	// skia:5595
704	badSerializeGMs = append(badSerializeGMs,
705		"composeshader_bitmap",
706		"scaled_tilemodes_npot",
707		"scaled_tilemodes",
708	)
709
710	// skia:5778
711	badSerializeGMs = append(badSerializeGMs, "typefacerendering_pfaMac")
712	// skia:5942
713	badSerializeGMs = append(badSerializeGMs, "parsedpaths")
714
715	// these use a custom image generator which doesn't serialize
716	badSerializeGMs = append(badSerializeGMs, "ImageGeneratorExternal_rect")
717	badSerializeGMs = append(badSerializeGMs, "ImageGeneratorExternal_shader")
718
719	// skia:6189
720	badSerializeGMs = append(badSerializeGMs, "shadow_utils")
721
722	// skia:7938
723	badSerializeGMs = append(badSerializeGMs, "persp_images")
724
725	// Not expected to round trip encoding/decoding.
726	badSerializeGMs = append(badSerializeGMs, "all_bitmap_configs")
727	badSerializeGMs = append(badSerializeGMs, "makecolorspace")
728	badSerializeGMs = append(badSerializeGMs, "readpixels")
729	badSerializeGMs = append(badSerializeGMs, "draw_image_set_rect_to_rect")
730	badSerializeGMs = append(badSerializeGMs, "draw_image_set_alpha_only")
731	badSerializeGMs = append(badSerializeGMs, "compositor_quads_shader")
732	badSerializeGMs = append(badSerializeGMs, "wacky_yuv_formats_qtr")
733	badSerializeGMs = append(badSerializeGMs, "runtime_effect_image")
734
735	// This GM forces a path to be convex. That property doesn't survive
736	// serialization.
737	badSerializeGMs = append(badSerializeGMs, "analytic_antialias_convex")
738
739	for _, test := range badSerializeGMs {
740		skip("serialize-8888", "gm", "_", test)
741	}
742
743	// It looks like we skip these only for out-of-memory concerns.
744	if b.matchOs("Win", "Android") {
745		for _, test := range []string{"verylargebitmap", "verylarge_picture_image"} {
746			skip("serialize-8888", "gm", "_", test)
747		}
748	}
749	if b.matchOs("Mac") && b.cpu() {
750		// skia:6992
751		skip("pic-8888", "gm", "_", "encode-platform")
752		skip("serialize-8888", "gm", "_", "encode-platform")
753	}
754
755	// skia:4769
756	skip("pic-8888", "gm", "_", "drawfilter")
757
758	// skia:4703
759	for _, test := range []string{"image-cacherator-from-picture",
760		"image-cacherator-from-raster",
761		"image-cacherator-from-ctable"} {
762		skip("pic-8888", "gm", "_", test)
763		skip("serialize-8888", "gm", "_", test)
764	}
765
766	// GM that requires raster-backed canvas
767	for _, test := range []string{"complexclip4_bw", "complexclip4_aa", "p3",
768		"async_rescale_and_read_text_up_large",
769		"async_rescale_and_read_text_up",
770		"async_rescale_and_read_text_down",
771		"async_rescale_and_read_dog_up",
772		"async_rescale_and_read_dog_down",
773		"async_rescale_and_read_rose",
774		"async_rescale_and_read_no_bleed",
775		"async_rescale_and_read_alpha_type"} {
776		skip("pic-8888", "gm", "_", test)
777		skip("serialize-8888", "gm", "_", test)
778
779		// GM requires canvas->makeSurface() to return a valid surface.
780		// TODO(borenet): These should be just outside of this block but are
781		// left here to match the recipe which has an indentation bug.
782		skip("pic-8888", "gm", "_", "blurrect_compare")
783		skip("serialize-8888", "gm", "_", "blurrect_compare")
784	}
785
786	// Extensions for RAW images
787	r := []string{
788		"arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw",
789		"ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW",
790	}
791
792	// skbug.com/4888
793	// Skip RAW images (and a few large PNGs) on GPU bots
794	// until we can resolve failures.
795	if b.gpu() {
796		skip("_ image _ interlaced1.png")
797		skip("_ image _ interlaced2.png")
798		skip("_ image _ interlaced3.png")
799		for _, rawExt := range r {
800			skip(fmt.Sprintf("_ image _ .%s", rawExt))
801		}
802	}
803
804	// Skip memory intensive tests on 32-bit bots.
805	if b.os("Win8") && b.arch("x86") {
806		skip("_ image f16 _")
807		skip("_ image _ abnormal.wbmp")
808		skip("_ image _ interlaced1.png")
809		skip("_ image _ interlaced2.png")
810		skip("_ image _ interlaced3.png")
811		for _, rawExt := range r {
812			skip(fmt.Sprintf("_ image _ .%s", rawExt))
813		}
814	}
815
816	if b.model("Nexus5", "Nexus5x") && b.gpu() {
817		// skia:5876
818		skip("_", "gm", "_", "encode-platform")
819	}
820
821	if b.model("AndroidOne") && b.gpu() { // skia:4697, skia:4704, skia:4694, skia:4705, skia:11133
822		skip("_", "gm", "_", "bigblurs")
823		skip("_", "gm", "_", "strict_constraint_no_red_allowed")
824		skip("_", "gm", "_", "fast_constraint_red_is_allowed")
825		skip("_", "gm", "_", "dropshadowimagefilter")
826		skip("_", "gm", "_", "filterfastbounds")
827		skip(glPrefix, "gm", "_", "imageblurtiled")
828		skip("_", "gm", "_", "imagefiltersclipped")
829		skip("_", "gm", "_", "imagefiltersscaled")
830		skip("_", "gm", "_", "imageresizetiled")
831		skip("_", "gm", "_", "matrixconvolution")
832		skip("_", "gm", "_", "strokedlines")
833		skip("_", "gm", "_", "runtime_intrinsics_matrix")
834		if sampleCount > 0 {
835			glMsaaConfig := fmt.Sprintf("%smsaa%d", glPrefix, sampleCount)
836			skip(glMsaaConfig, "gm", "_", "imageblurtiled")
837			skip(glMsaaConfig, "gm", "_", "imagefiltersbase")
838		}
839	}
840
841	if b.matchGpu("Adreno[3456][0-9][0-9]") { // disable broken tests on Adreno 3/4/5/6xx
842		skip("_", "tests", "_", "SkSLMatrixEquality_GPU")      // skia:11308
843		skip("_", "tests", "_", "DSLFPTest_SwitchStatement")   // skia:11891
844		skip("_", "tests", "_", "SkSLStructsInFunctions_GPU")  // skia:11929
845	}
846
847	match := []string{}
848	if b.extraConfig("Valgrind") { // skia:3021
849		match = append(match, "~Threaded")
850	}
851
852	if b.extraConfig("Valgrind") && b.extraConfig("PreAbandonGpuContext") {
853		// skia:6575
854		match = append(match, "~multipicturedraw_")
855	}
856
857	if b.model("AndroidOne") {
858		match = append(match, "~WritePixels")                             // skia:4711
859		match = append(match, "~PremulAlphaRoundTrip_Gpu")                // skia:7501
860		match = append(match, "~ReimportImageTextureWithMipLevels")       // skia:8090
861		match = append(match, "~MorphologyFilterRadiusWithMirrorCTM_Gpu") // skia:10383
862	}
863
864	if b.model("GalaxyS6") {
865		match = append(match, "~SpecialImage") // skia:6338
866		match = append(match, "~skbug6653")    // skia:6653
867	}
868
869	if b.extraConfig("MSAN") {
870		match = append(match, "~Once", "~Shared") // Not sure what's up with these tests.
871	}
872
873	// By default, we test with GPU threading enabled, unless specifically
874	// disabled.
875	if b.extraConfig("NoGPUThreads") {
876		args = append(args, "--gpuThreads", "0")
877	}
878
879	if b.extraConfig("Vulkan") && b.gpu("Adreno530") {
880		// skia:5777
881		match = append(match, "~CopySurface")
882	}
883
884	if b.extraConfig("Vulkan") && b.matchGpu("Adreno") {
885		// skia:7663
886		match = append(match, "~WritePixelsNonTextureMSAA_Gpu")
887		match = append(match, "~WritePixelsMSAA_Gpu")
888	}
889
890	if b.extraConfig("Vulkan") && b.isLinux() && b.gpu("IntelIris640") {
891		match = append(match, "~VkHeapTests") // skia:6245
892	}
893
894	if b.isLinux() && b.gpu("IntelIris640") {
895		match = append(match, "~Programs") // skia:7849
896	}
897
898	if b.model("TecnoSpark3Pro") {
899		// skia:9814
900		match = append(match, "~Programs")
901		match = append(match, "~ProcessorCloneTest")
902		match = append(match, "~ProcessorOptimizationValidationTest")
903	}
904
905	if b.gpu("IntelIris640", "IntelHD615", "IntelHDGraphics615") {
906		match = append(match, "~^SRGBReadWritePixels$") // skia:9225
907	}
908
909	if b.extraConfig("Vulkan") && b.isLinux() && b.gpu("IntelHD405") {
910		// skia:7322
911		skip("vk", "gm", "_", "skbug_257")
912		skip("vk", "gm", "_", "filltypespersp")
913		match = append(match, "~^ClearOp$")
914		match = append(match, "~^CopySurface$")
915		match = append(match, "~^ImageNewShader_GPU$")
916		match = append(match, "~^InitialTextureClear$")
917		match = append(match, "~^PinnedImageTest$")
918		match = append(match, "~^ReadPixels_Gpu$")
919		match = append(match, "~^ReadPixels_Texture$")
920		match = append(match, "~^SRGBReadWritePixels$")
921		match = append(match, "~^VkUploadPixelsTests$")
922		match = append(match, "~^WritePixelsNonTexture_Gpu$")
923		match = append(match, "~^WritePixelsNonTextureMSAA_Gpu$")
924		match = append(match, "~^WritePixels_Gpu$")
925		match = append(match, "~^WritePixelsMSAA_Gpu$")
926	}
927
928	if b.extraConfig("Vulkan") && b.gpu("GTX660") && b.matchOs("Win") {
929		// skbug.com/8047
930		match = append(match, "~FloatingPointTextureTest$")
931	}
932
933	if b.extraConfig("Metal") && b.gpu("RadeonHD8870M") && b.matchOs("Mac") {
934		// skia:9255
935		match = append(match, "~WritePixelsNonTextureMSAA_Gpu")
936		// skbug.com/11366
937		match = append(match, "~SurfacePartialDraw_Gpu")
938	}
939
940	if b.extraConfig("Metal") && b.gpu("PowerVRGX6450") && b.matchOs("iOS") {
941		// skbug.com/11885
942		match = append(match, "~flight_animated_image")
943	}
944
945	if b.extraConfig("Direct3D") {
946		// skia:9935
947		match = append(match, "~^DDLSkSurfaceFlush$")
948		match = append(match, "~^GrBackendTextureImageMipMappedTest$")
949		match = append(match, "~^GrTextureMipMapInvalidationTest$")
950		match = append(match, "~^SkImage_makeTextureImage$")
951		match = append(match, "~^TextureIdleStateTest$")
952	}
953
954	if b.extraConfig("ANGLE") {
955		// skia:7835
956		match = append(match, "~BlurMaskBiggerThanDest")
957	}
958
959	if b.gpu("IntelIris6100") && b.extraConfig("ANGLE") && !b.debug() {
960		// skia:7376
961		match = append(match, "~^ProcessorOptimizationValidationTest$")
962	}
963
964	if b.gpu("IntelIris6100", "IntelHD4400") && b.extraConfig("ANGLE") {
965		// skia:6857
966		skip("angle_d3d9_es2", "gm", "_", "lighting")
967	}
968
969	if b.gpu("PowerVRGX6250") {
970		match = append(match, "~gradients_view_perspective_nodither") //skia:6972
971	}
972
973	if b.arch("arm") && b.extraConfig("ASAN") {
974		// TODO: can we run with env allocator_may_return_null=1 instead?
975		match = append(match, "~BadImage")
976	}
977
978	if b.matchOs("Mac") && b.gpu("IntelHD6000") {
979		// skia:7574
980		match = append(match, "~^ProcessorCloneTest$")
981		match = append(match, "~^GrMeshTest$")
982	}
983
984	if b.matchOs("Mac") && b.gpu("IntelHD615") {
985		// skia:7603
986		match = append(match, "~^GrMeshTest$")
987	}
988
989	if b.extraConfig("Vulkan") && b.model("GalaxyS20") {
990		// skia:10247
991		match = append(match, "~VkPrepareForExternalIOQueueTransitionTest")
992	}
993
994	if len(skipped) > 0 {
995		args = append(args, "--skip")
996		args = append(args, skipped...)
997	}
998
999	if len(match) > 0 {
1000		args = append(args, "--match")
1001		args = append(args, match...)
1002	}
1003
1004	// These bots run out of memory running RAW codec tests. Do not run them in
1005	// parallel
1006	// TODO(borenet): Previously this was `'Nexus5' in bot or 'Nexus9' in bot`
1007	// which also matched 'Nexus5x'. I added That here to maintain the
1008	// existing behavior, but we should verify that it's needed.
1009	if b.model("Nexus5", "Nexus5x", "Nexus9") {
1010		args = append(args, "--noRAW_threading")
1011	}
1012
1013	if b.extraConfig("FSAA") {
1014		args = append(args, "--analyticAA", "false")
1015	}
1016	if b.extraConfig("FAAA") {
1017		args = append(args, "--forceAnalyticAA")
1018	}
1019
1020	if !b.extraConfig("NativeFonts") {
1021		args = append(args, "--nonativeFonts")
1022	}
1023
1024	if b.extraConfig("GDI") {
1025		args = append(args, "--gdi")
1026	}
1027
1028	// Let's make all bots produce verbose output by default.
1029	args = append(args, "--verbose")
1030
1031	// See skia:2789.
1032	if b.extraConfig("AbandonGpuContext") {
1033		args = append(args, "--abandonGpuContext")
1034	}
1035	if b.extraConfig("PreAbandonGpuContext") {
1036		args = append(args, "--preAbandonGpuContext")
1037	}
1038	if b.extraConfig("ReleaseAndAbandonGpuContext") {
1039		args = append(args, "--releaseAndAbandonGpuContext")
1040	}
1041
1042	// Finalize the DM flags and properties.
1043	b.recipeProp("dm_flags", marshalJson(args))
1044	b.recipeProp("dm_properties", marshalJson(properties))
1045
1046	// Add properties indicating which assets the task should use.
1047	if b.matchExtraConfig("Lottie") {
1048		b.asset("lottie-samples")
1049		b.recipeProp("lotties", "true")
1050	} else {
1051		b.asset("skimage")
1052		b.recipeProp("images", "true")
1053		b.asset("skp")
1054		b.recipeProp("skps", "true")
1055		b.asset("svg")
1056		b.recipeProp("svgs", "true")
1057	}
1058	b.recipeProp("do_upload", fmt.Sprintf("%t", b.doUpload()))
1059	b.recipeProp("resources", "true")
1060}
1061