all: skip tests if required tools are not found

Fixes golang/go#33950

Change-Id: Iefcb757e773bc052793611c099c25a457fd7e243
Reviewed-on: https://go-review.googlesource.com/c/tools/+/192400
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
diff --git a/go/packages/stdlib_test.go b/go/packages/stdlib_test.go
index c545b18..93d02d2 100644
--- a/go/packages/stdlib_test.go
+++ b/go/packages/stdlib_test.go
@@ -14,6 +14,7 @@
 	"time"
 
 	"golang.org/x/tools/go/packages"
+	"golang.org/x/tools/internal/testenv"
 )
 
 // This test loads the metadata for the standard library,
@@ -23,6 +24,8 @@
 	// 	t.Skipf("incomplete std lib on %s", runtime.GOOS)
 	// }
 
+	testenv.NeedsGoPackages(t)
+
 	runtime.GC()
 	t0 := time.Now()
 	var memstats runtime.MemStats
@@ -62,6 +65,8 @@
 		t.Skip("skipping in short mode; uses tons of memory (https://golang.org/issue/14113)")
 	}
 
+	testenv.NeedsGoPackages(t)
+
 	// TODO(adonovan): see if we can get away without these old
 	// go/loader hacks now that we use the go list command.
 	//