Skip to content

Commit 539cdc4

Browse files
matloobstamblerre
authored andcommitted
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent b53505e commit 539cdc4

File tree

7 files changed

+68
-0
lines changed

7 files changed

+68
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//+build race
6+
7+
// This file exists to allow us to detect that we're in race detector mode for temporarily
8+
// disabling tests that are broken on tip with the race detector turned on.
9+
// TODO(matloob): delete this once golang.org/issue/31749 is fixed.
10+
11+
package multichecker_test
12+
13+
func init() {
14+
race = true
15+
}

go/analysis/multichecker/multichecker_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"os/exec"
99
"runtime"
10+
"strings"
1011
"testing"
1112

1213
"golang.org/x/tools/go/analysis"
@@ -29,9 +30,15 @@ func main() {
2930
multichecker.Main(findcall.Analyzer, fail)
3031
}
3132

33+
var race = false
34+
3235
// TestExitCode ensures that analysis failures are reported correctly.
3336
// This test fork/execs the main function above.
3437
func TestExitCode(t *testing.T) {
38+
if v := runtime.Version(); strings.Contains(v, "devel") && race {
39+
t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
40+
}
41+
3542
if runtime.GOOS != "linux" {
3643
t.Skipf("skipping fork/exec test on this platform")
3744
}

go/loader/loader_race_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//+build race
6+
7+
// This file exists to allow us to detect that we're in race detector mode for temporarily
8+
// disabling tests that are broken on tip with the race detector turned on.
9+
// TODO(matloob): delete this once golang.org/issue/31749 is fixed.
10+
11+
package loader_test
12+
13+
func init() {
14+
race = true
15+
}

go/loader/loader_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,13 @@ func TestLoad_FromSource_Success(t *testing.T) {
262262
}
263263
}
264264

265+
var race = false
266+
265267
func TestLoad_FromImports_Success(t *testing.T) {
268+
if v := runtime.Version(); strings.Contains(v, "devel") && race {
269+
t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
270+
}
271+
266272
if runtime.Compiler == "gccgo" {
267273
t.Skip("gccgo has no standard library test files")
268274
}

go/packages/packages_race_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//+build race
6+
7+
// This file exists to allow us to detect that we're in race detector mode for temporarily
8+
// disabling tests that are broken on tip with the race detector turned on.
9+
// TODO(matloob): delete this once golang.org/issue/31749 is fixed.
10+
11+
package packages_test
12+
13+
func init() {
14+
race = true
15+
}

go/packages/packages_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,8 +2273,14 @@ const A = 4
22732273
}
22742274
}
22752275

2276+
var race = false
2277+
22762278
func TestIssue32814(t *testing.T) { packagestest.TestAll(t, testIssue32814) }
22772279
func testIssue32814(t *testing.T, exporter packagestest.Exporter) {
2280+
if v := runtime.Version(); strings.Contains(v, "devel") && race {
2281+
t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
2282+
}
2283+
22782284
exported := packagestest.Export(t, exporter, []packagestest.Module{{
22792285
Name: "golang.org/fake",
22802286
Files: map[string]interface{}{}}})

go/packages/stdlib_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import (
1919

2020
// This test loads the metadata for the standard library,
2121
func TestStdlibMetadata(t *testing.T) {
22+
if v := runtime.Version(); strings.Contains(v, "devel") && race {
23+
t.Skip("golang.org/issue/31749: This test is broken on tip in race mode. Skip until it's fixed.")
24+
}
25+
2226
// TODO(adonovan): see if we can get away without this hack.
2327
// if runtime.GOOS == "android" {
2428
// t.Skipf("incomplete std lib on %s", runtime.GOOS)

0 commit comments

Comments
 (0)