Skip to content

Commit 14d20dc

Browse files
author
Bryan C. Mills
committed
cmd/go: replace TestCgoDependsOnSyscall with a simpler script test
The existing test attempted to remove '_race' binaries from GOROOT/pkg, which could not only fail if GOROOT is read-only, but also interfere with other tests run in parallel. Updates #30316 Updates #37573 Updates #17751 Change-Id: Id7e2286ab67f8333baf4d52244b7f4476aa93a46 Reviewed-on: https://go-review.googlesource.com/c/go/+/223745 Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Jay Conrod <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent fb1cd94 commit 14d20dc

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

src/cmd/go/go_test.go

-28
Original file line numberDiff line numberDiff line change
@@ -1545,34 +1545,6 @@ func TestSymlinkWarning(t *testing.T) {
15451545
tg.grepStderr("ignoring symlink", "list should have reported symlink")
15461546
}
15471547

1548-
func TestCgoDependsOnSyscall(t *testing.T) {
1549-
if testing.Short() {
1550-
t.Skip("skipping test that removes $GOROOT/pkg/*_race in short mode")
1551-
}
1552-
if !canCgo {
1553-
t.Skip("skipping because cgo not enabled")
1554-
}
1555-
if !canRace {
1556-
t.Skip("skipping because race detector not supported")
1557-
}
1558-
1559-
tg := testgo(t)
1560-
defer tg.cleanup()
1561-
tg.parallel()
1562-
1563-
files, err := filepath.Glob(filepath.Join(runtime.GOROOT(), "pkg", "*_race"))
1564-
tg.must(err)
1565-
for _, file := range files {
1566-
tg.check(robustio.RemoveAll(file))
1567-
}
1568-
tg.tempFile("src/foo/foo.go", `
1569-
package foo
1570-
//#include <stdio.h>
1571-
import "C"`)
1572-
tg.setenv("GOPATH", tg.path("."))
1573-
tg.run("build", "-race", "foo")
1574-
}
1575-
15761548
func TestCgoShowsFullPathNames(t *testing.T) {
15771549
if !canCgo {
15781550
t.Skip("skipping because cgo not enabled")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[!cgo] skip
2+
[!race] skip
3+
4+
go list -race -deps foo
5+
stdout syscall
6+
7+
-- foo/foo.go --
8+
package foo
9+
10+
// #include <stdio.h>
11+
import "C"

0 commit comments

Comments
 (0)