1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:34:53 -07:00

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>
This commit is contained in:
Michael Matloob 2019-10-11 18:27:57 -04:00 committed by Rebecca Stambler
parent b53505e708
commit 539cdc44f8
7 changed files with 68 additions and 0 deletions

View File

@ -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
}

View File

@ -7,6 +7,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"runtime" "runtime"
"strings"
"testing" "testing"
"golang.org/x/tools/go/analysis" "golang.org/x/tools/go/analysis"
@ -29,9 +30,15 @@ func main() {
multichecker.Main(findcall.Analyzer, fail) multichecker.Main(findcall.Analyzer, fail)
} }
var race = false
// TestExitCode ensures that analysis failures are reported correctly. // TestExitCode ensures that analysis failures are reported correctly.
// This test fork/execs the main function above. // This test fork/execs the main function above.
func TestExitCode(t *testing.T) { 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" { if runtime.GOOS != "linux" {
t.Skipf("skipping fork/exec test on this platform") t.Skipf("skipping fork/exec test on this platform")
} }

View File

@ -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
}

View File

@ -262,7 +262,13 @@ func TestLoad_FromSource_Success(t *testing.T) {
} }
} }
var race = false
func TestLoad_FromImports_Success(t *testing.T) { 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" { if runtime.Compiler == "gccgo" {
t.Skip("gccgo has no standard library test files") t.Skip("gccgo has no standard library test files")
} }

View File

@ -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
}

View File

@ -2273,8 +2273,14 @@ const A = 4
} }
} }
var race = false
func TestIssue32814(t *testing.T) { packagestest.TestAll(t, testIssue32814) } func TestIssue32814(t *testing.T) { packagestest.TestAll(t, testIssue32814) }
func testIssue32814(t *testing.T, exporter packagestest.Exporter) { 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{{ exported := packagestest.Export(t, exporter, []packagestest.Module{{
Name: "golang.org/fake", Name: "golang.org/fake",
Files: map[string]interface{}{}}}) Files: map[string]interface{}{}}})

View File

@ -19,6 +19,10 @@ import (
// This test loads the metadata for the standard library, // This test loads the metadata for the standard library,
func TestStdlibMetadata(t *testing.T) { 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. // TODO(adonovan): see if we can get away without this hack.
// if runtime.GOOS == "android" { // if runtime.GOOS == "android" {
// t.Skipf("incomplete std lib on %s", runtime.GOOS) // t.Skipf("incomplete std lib on %s", runtime.GOOS)