Commit 7340d15c authored by Michael Matloob's avatar Michael Matloob

cmd/go: convert TestImportCycle to the script framework

This test already calls tg.Parallel

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I4cdb2464cd3e51f1369558c238925f036ce8d828
Reviewed-on: https://go-review.googlesource.com/c/go/+/213426
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
parent b8e2ffcb
...@@ -1072,25 +1072,6 @@ func TestImportCommentConflict(t *testing.T) { ...@@ -1072,25 +1072,6 @@ func TestImportCommentConflict(t *testing.T) {
tg.grepStderr("found import comments", "go build did not mention comment conflict") tg.grepStderr("found import comments", "go build did not mention comment conflict")
} }
func TestImportCycle(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcycle"))
tg.runFail("build", "selfimport")
count := tg.grepCountBoth("import cycle not allowed")
if count == 0 {
t.Fatal("go build did not mention cyclical import")
}
if count > 1 {
t.Fatal("go build mentioned import cycle more than once")
}
// Don't hang forever.
tg.run("list", "-e", "-json", "selfimport")
}
// cmd/go: custom import path checking should not apply to Go packages without import comment. // cmd/go: custom import path checking should not apply to Go packages without import comment.
func TestIssue10952(t *testing.T) { func TestIssue10952(t *testing.T) {
testenv.MustHaveExternalNetwork(t) testenv.MustHaveExternalNetwork(t)
......
! go build selfimport
stderr -count=1 'import cycle not allowed'
go list -e -f '{{.Error}}' selfimport # Don't hang forever
stdout -count=1 'import cycle not allowed'
-- selfimport/selfimport.go --
package selfimport
import "selfimport"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment