1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:20:03 -07:00

cmd/go: convert TestCoveragePattern to the script framework

This test already runs in parallel, but still convert it to the
script framework so we can delete the testdata/src directory and
remove any ambiguity about which tests can run in parallel.

Updates #36320

Change-Id: I6470979bd8bad0631dc6ead0d4eb9c83878356e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/212815
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Michael Matloob 2019-12-30 17:10:23 -05:00
parent 4ffd1a0f1c
commit c57665f4e6
5 changed files with 37 additions and 41 deletions

View File

@ -2193,22 +2193,6 @@ func TestCoverageImportMainLoop(t *testing.T) {
tg.grepStderr("not an importable package", "did not detect import main") tg.grepStderr("not an importable package", "did not detect import main")
} }
func TestCoveragePattern(t *testing.T) {
skipIfGccgo(t, "gccgo has no cover tool")
tooSlow(t)
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
tg.makeTempdir()
tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata"))
// If coverpkg=sleepy... expands by package loading
// (as opposed to pattern matching on deps)
// then it will try to load sleepybad, which does not compile,
// and the test command will fail.
tg.run("test", "-coverprofile="+tg.path("cover.out"), "-coverpkg=sleepy...", "-run=^$", "sleepy1")
}
func TestCoverageErrorLine(t *testing.T) { func TestCoverageErrorLine(t *testing.T) {
skipIfGccgo(t, "gccgo has no cover tool") skipIfGccgo(t, "gccgo has no cover tool")
tooSlow(t) tooSlow(t)

View File

@ -0,0 +1,37 @@
[gccgo] skip
# If coverpkg=sleepy... expands by package loading
# (as opposed to pattern matching on deps)
# then it will try to load sleepybad, which does not compile,
# and the test command will fail.
! go list sleepy...
go test -c -n -coverprofile=$TMPDIR/cover.out -coverpkg=sleepy... -run=^$ sleepy1
-- sleepy1/p_test.go --
package p
import (
"testing"
"time"
)
func Test1(t *testing.T) {
time.Sleep(200 * time.Millisecond)
}
-- sleepy2/p_test.go --
package p
import (
"testing"
"time"
)
func Test1(t *testing.T) {
time.Sleep(200 * time.Millisecond)
}
-- sleepybad/p.go --
package p
import ^
var _ = io.DoesNotExist

View File

@ -1,10 +0,0 @@
package p
import (
"testing"
"time"
)
func Test1(t *testing.T) {
time.Sleep(200 * time.Millisecond)
}

View File

@ -1,10 +0,0 @@
package p
import (
"testing"
"time"
)
func Test1(t *testing.T) {
time.Sleep(200 * time.Millisecond)
}

View File

@ -1,5 +0,0 @@
package p
// missing import
var _ = io.DoesNotExist