Skip to content

Commit 15c106d

Browse files
shivakumargnBryan C. Mills
authored and
Bryan C. Mills
committed
cmd/go: 3 cmd/go tests (>8s) made as non-short scripts
* TestAtomicCoverpkgAll -> Script/cover_atomic_pkgall.txt and make it * non-short * TestCoverpkgAllRuntime -> Script/cover_pkgall_runtime.txt and make it * non-short * TestCpuprofileTwice -> Script/cpu_profile_twice.txt and make it * non-short * TestGoTestMainTwice -> make it non-short Updates #26472 Change-Id: I24f3d4c2a8b6e317adb369a1b1426e693f9571ed Reviewed-on: https://go-review.googlesource.com/126636 Reviewed-by: Bryan C. Mills <[email protected]> Run-TryBot: Bryan C. Mills <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent a685a8d commit 15c106d

File tree

4 files changed

+67
-51
lines changed

4 files changed

+67
-51
lines changed

src/cmd/go/go_test.go

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,6 +3047,9 @@ func TestGoTestMainAsNormalTest(t *testing.T) {
30473047
}
30483048

30493049
func TestGoTestMainTwice(t *testing.T) {
3050+
if testing.Short() {
3051+
t.Skip("Skipping in short mode")
3052+
}
30503053
tg := testgo(t)
30513054
defer tg.cleanup()
30523055
tg.makeTempdir()
@@ -5817,57 +5820,6 @@ func init() {}
58175820
tg.run("test", "a")
58185821
}
58195822

5820-
// Issue 23150.
5821-
func TestCpuprofileTwice(t *testing.T) {
5822-
tg := testgo(t)
5823-
defer tg.cleanup()
5824-
tg.parallel()
5825-
tg.tempFile("prof/src/x/x_test.go", `
5826-
package x_test
5827-
import (
5828-
"testing"
5829-
"time"
5830-
)
5831-
func TestSleep(t *testing.T) { time.Sleep(10 * time.Millisecond) }`)
5832-
tg.setenv("GOPATH", tg.path("prof"))
5833-
bin := tg.path("x.test")
5834-
out := tg.path("cpu.out")
5835-
tg.run("test", "-o="+bin, "-cpuprofile="+out, "x")
5836-
tg.must(os.Remove(out))
5837-
tg.run("test", "-o="+bin, "-cpuprofile="+out, "x")
5838-
tg.mustExist(out)
5839-
}
5840-
5841-
// Issue 23694.
5842-
func TestAtomicCoverpkgAll(t *testing.T) {
5843-
tg := testgo(t)
5844-
defer tg.cleanup()
5845-
tg.parallel()
5846-
5847-
tg.tempFile("src/x/x.go", `package x; import _ "sync/atomic"; func F() {}`)
5848-
tg.tempFile("src/x/x_test.go", `package x; import "testing"; func TestF(t *testing.T) { F() }`)
5849-
tg.setenv("GOPATH", tg.path("."))
5850-
tg.run("test", "-coverpkg=all", "-covermode=atomic", "x")
5851-
if canRace {
5852-
tg.run("test", "-coverpkg=all", "-race", "x")
5853-
}
5854-
}
5855-
5856-
// Issue 23882.
5857-
func TestCoverpkgAllRuntime(t *testing.T) {
5858-
tg := testgo(t)
5859-
defer tg.cleanup()
5860-
tg.parallel()
5861-
5862-
tg.tempFile("src/x/x.go", `package x; import _ "runtime"; func F() {}`)
5863-
tg.tempFile("src/x/x_test.go", `package x; import "testing"; func TestF(t *testing.T) { F() }`)
5864-
tg.setenv("GOPATH", tg.path("."))
5865-
tg.run("test", "-coverpkg=all", "x")
5866-
if canRace {
5867-
tg.run("test", "-coverpkg=all", "-race", "x")
5868-
}
5869-
}
5870-
58715823
func TestBadCommandLines(t *testing.T) {
58725824
tg := testgo(t)
58735825
defer tg.cleanup()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[short] skip
2+
3+
go test -coverpkg=all -covermode=atomic x
4+
stdout ok[\s\S]+?coverage
5+
6+
[!race] stop
7+
8+
go test -coverpkg=all -race x
9+
stdout ok[\s\S]+?coverage
10+
11+
-- x/x.go --
12+
package x
13+
14+
import _ "sync/atomic"
15+
16+
func F() {}
17+
18+
-- x/x_test.go --
19+
package x
20+
21+
import "testing"
22+
23+
func TestF(t *testing.T) { F() }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Issue 23882
2+
3+
[short] skip
4+
5+
go test -coverpkg=all x
6+
stdout ok[\s\S]+?coverage
7+
8+
[!race] stop
9+
10+
go test -coverpkg=all -race x
11+
stdout ok[\s\S]+?coverage
12+
13+
-- x/x.go --
14+
package x
15+
import _ "runtime"
16+
func F() {}
17+
18+
-- x/x_test.go --
19+
package x
20+
import "testing"
21+
func TestF(t *testing.T) { F() }
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Issue 23150
2+
3+
[short] skip
4+
5+
go test -o=$WORK/x.test -cpuprofile=$WORK/cpu_profile_twice.out x
6+
rm $WORK/cpu_profile_twice.out
7+
8+
go test -o=$WORK/x.test -cpuprofile=$WORK/cpu_profile_twice.out x
9+
exists $WORK/cpu_profile_twice.out
10+
11+
12+
-- x/x_test.go --
13+
package x_test
14+
import (
15+
"testing"
16+
"time"
17+
)
18+
func TestSleep(t *testing.T) {
19+
time.Sleep(10 * time.Millisecond)
20+
}

0 commit comments

Comments
 (0)