go/packages: temporarily disable some tests running on go tip with -race
A change in go/types has uncovered a race in go/packages. While we debug,
ignore those tests when running on tip with -race to make the builders
green. This change will be reverted as soon as the issue is fixed.
Updates golang/go#31749
Change-Id: I96f0b30a1bc203a5c36a2ce30c943583b7f8035a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/200819
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
diff --git a/go/analysis/multichecker/multichecker_race_test.go b/go/analysis/multichecker/multichecker_race_test.go
new file mode 100644
index 0000000..67dce86
--- /dev/null
+++ b/go/analysis/multichecker/multichecker_race_test.go
@@ -0,0 +1,15 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//+build race
+
+// This file exists to allow us to detect that we're in race detector mode for temporarily
+// disabling tests that are broken on tip with the race detector turned on.
+// TODO(matloob): delete this once golang.org/issue/31749 is fixed.
+
+package multichecker_test
+
+func init() {
+ race = true
+}
diff --git a/go/analysis/multichecker/multichecker_test.go b/go/analysis/multichecker/multichecker_test.go
index ca3dab5..9c13410 100644
--- a/go/analysis/multichecker/multichecker_test.go
+++ b/go/analysis/multichecker/multichecker_test.go
@@ -7,6 +7,7 @@
"os"
"os/exec"
"runtime"
+ "strings"
"testing"
"golang.org/x/tools/go/analysis"
@@ -29,9 +30,15 @@
multichecker.Main(findcall.Analyzer, fail)
}
+var race = false
+
// TestExitCode ensures that analysis failures are reported correctly.
// This test fork/execs the main function above.
func TestExitCode(t *testing.T) {
+ if v := runtime.Version(); strings.Contains(v, "devel") && race {
+ t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
+ }
+
if runtime.GOOS != "linux" {
t.Skipf("skipping fork/exec test on this platform")
}
diff --git a/go/loader/loader_race_test.go b/go/loader/loader_race_test.go
new file mode 100644
index 0000000..710deec
--- /dev/null
+++ b/go/loader/loader_race_test.go
@@ -0,0 +1,15 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//+build race
+
+// This file exists to allow us to detect that we're in race detector mode for temporarily
+// disabling tests that are broken on tip with the race detector turned on.
+// TODO(matloob): delete this once golang.org/issue/31749 is fixed.
+
+package loader_test
+
+func init() {
+ race = true
+}
diff --git a/go/loader/loader_test.go b/go/loader/loader_test.go
index 5fa3254..61292a0 100644
--- a/go/loader/loader_test.go
+++ b/go/loader/loader_test.go
@@ -262,7 +262,13 @@
}
}
+var race = false
+
func TestLoad_FromImports_Success(t *testing.T) {
+ if v := runtime.Version(); strings.Contains(v, "devel") && race {
+ t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
+ }
+
if runtime.Compiler == "gccgo" {
t.Skip("gccgo has no standard library test files")
}
diff --git a/go/packages/packages_race_test.go b/go/packages/packages_race_test.go
new file mode 100644
index 0000000..dd90d1c
--- /dev/null
+++ b/go/packages/packages_race_test.go
@@ -0,0 +1,15 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//+build race
+
+// This file exists to allow us to detect that we're in race detector mode for temporarily
+// disabling tests that are broken on tip with the race detector turned on.
+// TODO(matloob): delete this once golang.org/issue/31749 is fixed.
+
+package packages_test
+
+func init() {
+ race = true
+}
diff --git a/go/packages/packages_test.go b/go/packages/packages_test.go
index 4b094c4..4b9720a 100644
--- a/go/packages/packages_test.go
+++ b/go/packages/packages_test.go
@@ -2273,8 +2273,14 @@
}
}
+var race = false
+
func TestIssue32814(t *testing.T) { packagestest.TestAll(t, testIssue32814) }
func testIssue32814(t *testing.T, exporter packagestest.Exporter) {
+ if v := runtime.Version(); strings.Contains(v, "devel") && race {
+ t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
+ }
+
exported := packagestest.Export(t, exporter, []packagestest.Module{{
Name: "golang.org/fake",
Files: map[string]interface{}{}}})
diff --git a/go/packages/stdlib_test.go b/go/packages/stdlib_test.go
index 93d02d2..2ab00da 100644
--- a/go/packages/stdlib_test.go
+++ b/go/packages/stdlib_test.go
@@ -19,6 +19,10 @@
// This test loads the metadata for the standard library,
func TestStdlibMetadata(t *testing.T) {
+ if v := runtime.Version(); strings.Contains(v, "devel") && race {
+ t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
+ }
+
// TODO(adonovan): see if we can get away without this hack.
// if runtime.GOOS == "android" {
// t.Skipf("incomplete std lib on %s", runtime.GOOS)