cmd/gobind: fix tests on the linux-amd64-longtest builder

The builder doesn't have javap nor the Android fonts installed.

Change-Id: Ia3965be967482aa76b0c8c83b951deb30ebe5645
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/167057
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/cmd/gobind/gobind_test.go b/cmd/gobind/gobind_test.go
index 7302f56..7924f06 100644
--- a/cmd/gobind/gobind_test.go
+++ b/cmd/gobind/gobind_test.go
@@ -21,13 +21,16 @@
 	lang string
 	pkg  string
 	goos string
+	// reverse is true if the test needs to generate reverse bindings using
+	// external tools such as javap.
+	reverse bool
 }{
-	{"ObjC-Testpkg", "objc", "golang.org/x/mobile/bind/testdata/testpkg", ""},
-	{"Java-Testpkg", "java", "golang.org/x/mobile/bind/testdata/testpkg", ""},
-	{"Go-Testpkg", "go", "golang.org/x/mobile/bind/testdata/testpkg", ""},
-	{"Java-Javapkg", "java", "golang.org/x/mobile/bind/testdata/testpkg/javapkg", "android"},
-	{"Go-Javapkg", "go", "golang.org/x/mobile/bind/testdata/testpkg/javapkg", "android"},
-	{"Go-Javapkg", "go,java,objc", "golang.org/x/mobile/bind/testdata/cgopkg", "android"},
+	{"ObjC-Testpkg", "objc", "golang.org/x/mobile/bind/testdata/testpkg", "", false},
+	{"Java-Testpkg", "java", "golang.org/x/mobile/bind/testdata/testpkg", "", false},
+	{"Go-Testpkg", "go", "golang.org/x/mobile/bind/testdata/testpkg", "", false},
+	{"Java-Javapkg", "java", "golang.org/x/mobile/bind/testdata/testpkg/javapkg", "android", true},
+	{"Go-Javapkg", "go", "golang.org/x/mobile/bind/testdata/testpkg/javapkg", "android", true},
+	{"Go-Javapkg", "go,java,objc", "golang.org/x/mobile/bind/testdata/cgopkg", "android", false},
 }
 
 var gobindBin string
@@ -68,8 +71,12 @@
 }
 
 func TestGobind(t *testing.T) {
+	_, javapErr := exec.LookPath("javap")
 	for _, test := range tests {
 		t.Run(test.name, func(t *testing.T) {
+			if test.reverse && javapErr != nil {
+				t.Skip("reverse bind test requires javap which is not available")
+			}
 			if err := runGobind(t, test.lang, test.pkg, test.goos); err != nil {
 				t.Error(err)
 			}
@@ -117,8 +124,12 @@
 }
 
 func BenchmarkGobind(b *testing.B) {
+	_, javapErr := exec.LookPath("javap")
 	for _, test := range tests {
 		b.Run(test.name, func(b *testing.B) {
+			if test.reverse && javapErr != nil {
+				b.Skip("reverse bind test requires javap which is not available")
+			}
 			for i := 0; i < b.N; i++ {
 				if err := runGobind(b, test.lang, test.pkg, test.goos); err != nil {
 					b.Error(err)
diff --git a/exp/font/font_test.go b/exp/font/font_test.go
index f1e8b87..296f7e3 100644
--- a/exp/font/font_test.go
+++ b/exp/font/font_test.go
@@ -36,11 +36,22 @@
 	return nil
 }
 
-func TestLoadFonts(t *testing.T) {
-	if err := looksLikeATTF(Default()); err != nil {
+func TestLoadDefault(t *testing.T) {
+	def, err := buildDefault()
+	if err != nil {
+		t.Skip("default font not found")
+	}
+	if err := looksLikeATTF(def); err != nil {
 		t.Errorf("default font: %v", err)
 	}
-	if err := looksLikeATTF(Monospace()); err != nil {
+}
+
+func TestLoadMonospace(t *testing.T) {
+	mono, err := buildMonospace()
+	if err != nil {
+		t.Skip("mono font not found")
+	}
+	if err := looksLikeATTF(mono); err != nil {
 		t.Errorf("monospace font: %v", err)
 	}
 }