go/packages: fix/skip some tests making build.golang.org red

Updates golang/go#26387

Change-Id: I5d91f3747b4f17186813d830f24aa510f5cf0060
Reviewed-on: https://go-review.googlesource.com/123957
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Brad Fitzpatrick 2018-07-14 19:31:00 +00:00
parent 18e9dfbf20
commit fd2d2c45eb
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"runtime"
"sort" "sort"
"strings" "strings"
"sync" "sync"
@ -46,6 +47,9 @@ import (
// - test typechecking of generated test main and cgo. // - test typechecking of generated test main and cgo.
func TestMetadataImportGraph(t *testing.T) { func TestMetadataImportGraph(t *testing.T) {
if runtime.GOOS != "linux" {
t.Skipf("TODO: skipping on non-Linux; fix this test to run everywhere. golang.org/issue/26387")
}
tmp, cleanup := enterTree(t, map[string]string{ tmp, cleanup := enterTree(t, map[string]string{
"src/a/a.go": `package a; const A = 1`, "src/a/a.go": `package a; const A = 1`,
"src/b/b.go": `package b; import ("a"; _ "errors"); var B = a.A`, "src/b/b.go": `package b; import ("a"; _ "errors"); var B = a.A`,

View File

@ -44,7 +44,9 @@ func TestStdlibMetadata(t *testing.T) {
t.Logf("Loaded %d packages", len(pkgs)) t.Logf("Loaded %d packages", len(pkgs))
numPkgs := len(pkgs) numPkgs := len(pkgs)
if want := 186; numPkgs < want {
want := 150 // 186 on linux, 185 on windows.
if numPkgs < want {
t.Errorf("Loaded only %d packages, want at least %d", numPkgs, want) t.Errorf("Loaded only %d packages, want at least %d", numPkgs, want)
} }