dashboard: verify that each port is covered by real or misc-compile trybot

Currently, android/{386,arm,arm64} are not covered, so add a
misc-compile builder for these.

Also correct a typo in the comment for the darwin misc-compile builder
and add update the misc-compile-freebsd comment to include
freebsd/arm64.

Change-Id: Ica3b27e98db73c10edf30260acddcd7ea57d9051
Reviewed-on: https://go-review.googlesource.com/c/build/+/205798
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index 0fe9072..017b3d7 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -9,6 +9,7 @@
 	"fmt"
 	"os/exec"
 	"path/filepath"
+	"regexp"
 	"runtime"
 	"sort"
 	"strings"
@@ -94,6 +95,7 @@
 				"linux-386",
 				"linux-amd64",
 				"linux-amd64-race",
+				"misc-compile-android",
 				"misc-compile-other",
 				"misc-compile-darwin",
 				"misc-compile-linuxarm",
@@ -118,6 +120,7 @@
 				"linux-386",
 				"linux-amd64",
 				"linux-amd64-race",
+				"misc-compile-android",
 				"misc-compile-other",
 				"misc-compile-darwin",
 				"misc-compile-linuxarm",
@@ -143,6 +146,7 @@
 				"linux-386",
 				"linux-amd64",
 				"linux-amd64-race",
+				"misc-compile-android",
 				"misc-compile-darwin",
 				"misc-compile-freebsd",
 				"misc-compile-linuxarm",
@@ -739,3 +743,58 @@
 		}
 	}
 }
+
+// TestTryBotsCompileAllPorts verifies that each port (go tool dist list) is covered by
+// either a real trybot or a misc-compile trybot.
+func TestTryBotsCompileAllPorts(t *testing.T) {
+	out, err := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "tool", "dist", "list").Output()
+	if err != nil {
+		t.Errorf("dist list: %v", err)
+	}
+	ports := strings.Fields(string(out))
+
+	done := map[string]bool{}
+	done["nacl-386"] = true // removed in Go 1.14
+	done["nacl-arm"] = true // removed in Go 1.14
+	check := func(goos, goarch string) {
+		goosArch := goos + "-" + goarch
+		if done[goosArch] {
+			return
+		}
+		for _, conf := range Builders {
+			os := conf.GOOS()
+			arch := conf.GOARCH()
+
+			if os == goos && arch == goarch && (conf.tryOnly || conf.tryBot != nil) {
+				done[goosArch] = true
+				break
+			}
+
+			if strings.HasPrefix(conf.Name, "misc-compile-") {
+				re, err := regexp.Compile(conf.allScriptArgs[0])
+				if err != nil {
+					t.Errorf("Invalid misc-compile filtering pattern for builder %q: %q",
+						conf.Name, conf.allScriptArgs[0])
+				}
+
+				if re.MatchString(goosArch) || re.MatchString(goos) {
+					done[goosArch] = true
+					break
+				}
+			}
+		}
+		if _, ok := done[goosArch]; !ok {
+			t.Errorf("Missing trybot or misc-compile trybot: %q", goosArch)
+		}
+
+	}
+
+	for _, port := range ports {
+		slash := strings.IndexByte(port, '/')
+		if slash == -1 {
+			t.Fatalf("unexpected port %q", port)
+		}
+		check(port[:slash], port[slash+1:])
+	}
+
+}