mirror of
https://github.com/golang/go
synced 2024-11-23 14:20:05 -07:00
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: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
b8e2ffcb90
commit
7340d15c85
@ -1072,25 +1072,6 @@ func TestImportCommentConflict(t *testing.T) {
|
||||
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.
|
||||
func TestIssue10952(t *testing.T) {
|
||||
testenv.MustHaveExternalNetwork(t)
|
||||
|
@ -1,3 +0,0 @@
|
||||
package selfimport
|
||||
|
||||
import "selfimport"
|
10
src/cmd/go/testdata/script/build_import_cycle.txt
vendored
Normal file
10
src/cmd/go/testdata/script/build_import_cycle.txt
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
! 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"
|
Loading…
Reference in New Issue
Block a user