[infra/bots] Treat extra_config as a list.

Dependency of https://skia-review.googlesource.com/c/14525/

No-Try: true
Change-Id: I7686576aa48865116fe8a593f08d395f901a1d04
Reviewed-on: https://skia-review.googlesource.com/14524
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go
index 4a1ac7a..a9e0e74 100644
--- a/infra/bots/gen_tasks.go
+++ b/infra/bots/gen_tasks.go
@@ -86,30 +86,31 @@
 		return "Build-Ubuntu-GCC-x86_64-Release-Shared"
 	} else if parts["role"] == "Test" || parts["role"] == "Perf" {
 		task_os := parts["os"]
-		ec := parts["extra_config"]
-		ec = strings.TrimSuffix(ec, "_Skpbench")
-		ec = strings.TrimSuffix(ec, "_AbandonGpuContext")
-		ec = strings.TrimSuffix(ec, "_PreAbandonGpuContext")
-		if ec == "Valgrind" {
-			// skia:6267
-			ec = ""
-		}
-		if ec == "ReleaseAndAbandonGpuContext" {
-			ec = ""
+		ec := []string{}
+		if val := parts["extra_config"]; val != "" {
+			ec = strings.Split(val, "_")
+			ignore := []string{"Skpbench", "AbandonGpuContext", "PreAbandonGpuContext", "Valgrind", "ReleaseAndAbandonGpuContext", "RaspberryPi"}
+			keep := make([]string, 0, len(ec))
+			for _, part := range ec {
+				if !util.In(part, ignore) {
+					keep = append(keep, part)
+				}
+			}
+			ec = keep
 		}
 		if task_os == "Android" {
-			if ec == "Vulkan" {
-				ec = "Android_Vulkan"
+			if !util.In("Android", ec) {
+				ec = append([]string{"Android"}, ec...)
 			}
 			task_os = "Ubuntu"
 		} else if task_os == "Chromecast" {
 			task_os = "Ubuntu"
-			ec = "Chromecast"
+			ec = append([]string{"Chromecast"}, ec...)
 		} else if strings.Contains(task_os, "ChromeOS") {
-			ec = "Chromebook_ARM_GLES"
+			ec = append([]string{"Chromebook", "ARM", "GLES"}, ec...)
 			task_os = "Ubuntu"
 		} else if task_os == "iOS" {
-			ec = task_os
+			ec = append([]string{task_os}, ec...)
 			task_os = "Mac"
 		} else if strings.Contains(task_os, "Win") {
 			task_os = "Win"
@@ -123,8 +124,8 @@
 			"target_arch":   parts["arch"],
 			"configuration": parts["configuration"],
 		}
-		if ec != "" {
-			jobNameMap["extra_config"] = ec
+		if len(ec) > 0 {
+			jobNameMap["extra_config"] = strings.Join(ec, "_")
 		}
 		name, err := jobNameSchema.MakeJobName(jobNameMap)
 		if err != nil {
diff --git a/infra/bots/recipes/perf.py b/infra/bots/recipes/perf.py
index 2d3cef0..f5a0254 100644
--- a/infra/bots/recipes/perf.py
+++ b/infra/bots/recipes/perf.py
@@ -280,7 +280,8 @@
       })
 
   # See skia:2789.
-  if '_AbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''):
+  extra_config_parts = api.vars.builder_cfg.get('extra_config', '').split('_')
+  if 'AbandonGpuContext' in extra_config_parts:
     args.extend(['--abandonGpuContext', '--nocpu'])
 
   with api.env(env):
diff --git a/infra/bots/recipes/test.py b/infra/bots/recipes/test.py
index 4fbf7eb..9449b01 100644
--- a/infra/bots/recipes/test.py
+++ b/infra/bots/recipes/test.py
@@ -676,12 +676,12 @@
       })
 
   # See skia:2789.
-  if '_AbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''):
+  extra_config_parts = api.vars.builder_cfg.get('extra_config', '').split('_')
+  if 'AbandonGpuContext' in extra_config_parts:
     args.append('--abandonGpuContext')
-  if '_PreAbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''):
+  if 'PreAbandonGpuContext' in extra_config_parts:
     args.append('--preAbandonGpuContext')
-  if ('ReleaseAndAbandonGpuContext' in
-      api.vars.builder_cfg.get('extra_config', '')):
+  if 'ReleaseAndAbandonGpuContext' in extra_config_parts:
     args.append('--releaseAndAbandonGpuContext')
 
   with api.env(env):