Commit c399afef authored by Michael Matloob's avatar Michael Matloob

cmd/go: convert TestCoverageImportMainLoop and TestGoTestMain

Convert these two tests to the script framework.

Updates #17751
Updates #36320

Change-Id: I9cc14360fab949dab91f9e5e667be85002ef5926
Reviewed-on: https://go-review.googlesource.com/c/go/+/212811
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: default avatarJay Conrod <jayconrod@google.com>
parent cde230b8
......@@ -2144,17 +2144,6 @@ func TestCoverageNoStatements(t *testing.T) {
tg.grepStdout("[no statements]", "expected [no statements] for pkg4")
}
func TestCoverageImportMainLoop(t *testing.T) {
skipIfGccgo(t, "gccgo has no cover tool")
tg := testgo(t)
defer tg.cleanup()
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
tg.runFail("test", "importmain/test")
tg.grepStderr("not an importable package", "did not detect import main")
tg.runFail("test", "-cover", "importmain/test")
tg.grepStderr("not an importable package", "did not detect import main")
}
func TestCoverageErrorLine(t *testing.T) {
skipIfGccgo(t, "gccgo has no cover tool")
tooSlow(t)
......@@ -2587,21 +2576,6 @@ func TestGoTestMainAsNormalTest(t *testing.T) {
tg.grepBoth(okPattern, "go test did not say ok")
}
func TestGoTestMainTwice(t *testing.T) {
if testing.Short() {
t.Skip("Skipping in short mode")
}
tg := testgo(t)
defer tg.cleanup()
tg.makeTempdir()
tg.setenv("GOCACHE", tg.tempdir)
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
tg.run("test", "-v", "multimain")
if strings.Count(tg.getStdout(), "notwithstanding") != 2 {
t.Fatal("tests did not run twice")
}
}
func TestGoTestXtestonlyWorks(t *testing.T) {
tg := testgo(t)
defer tg.cleanup()
......
[gccgo] skip # gccgo has no cover tool
! go test -n importmain/test
stderr 'not an importable package' # check that import main was detected
! go test -n -cover importmain/test
stderr 'not an importable package' # check that import main was detected
-- importmain/ismain/main.go --
package main
import _ "importmain/test"
func main() {}
-- importmain/test/test.go --
package test
-- importmain/test/test_test.go --
package test_test
import "testing"
import _ "importmain/ismain"
func TestCase(t *testing.T) {}
[short] skip
env GOCACHE=$TMPDIR
go test -v multimain
stdout -count=2 notwithstanding # check tests ran twice
-- multimain/multimain_test.go --
package multimain_test
import "testing"
......
package main
import _ "importmain/test"
func main() {}
package test_test
import "testing"
import _ "importmain/ismain"
func TestCase(t *testing.T) {}
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