Skip to content

Commit 37026a7

Browse files
committed
cmd/go: skip some tests that run builds in short mode
cmd/go tests that run builds are generally skipped in short mode. This change will adds skips for some tests that were running builds. I found these by sorting tests by elapsed time and removing the top tests that invoked go build. It's our practice to skip tests that run go build without the -n flag (which prints but doesn't execute commands). On my work laptop this reduces test run time from about 20 seconds to about 16 seconds. On my linux workstation it reduces test run time from about 10 seconds to about 5 seconds. Change-Id: I18ffcc231df013cb6ac5f5eb3544bed28dadeda8 Reviewed-on: https://go-review.googlesource.com/c/go/+/653775 Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 932a4a4 commit 37026a7

9 files changed

+18
-0
lines changed

src/cmd/go/go_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,8 @@ func TestGoListCompiledCgo(t *testing.T) {
11471147
}
11481148

11491149
func TestGoListExport(t *testing.T) {
1150+
tooSlow(t, "runs build for -export")
1151+
11501152
skipIfGccgo(t, "gccgo does not have standard packages")
11511153
tg := testgo(t)
11521154
defer tg.cleanup()

src/cmd/go/note_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
)
1414

1515
func TestNoteReading(t *testing.T) {
16+
tooSlow(t, "runs build")
17+
1618
// cmd/internal/buildid already has tests that the basic reading works.
1719
// This test is essentially checking that -ldflags=-buildid=XXX works,
1820
// both in internal and external linking mode.

src/cmd/go/testdata/script/build_GOTMPDIR.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[short] skip 'runs build'
2+
13
# Set GOCACHE to a clean directory to ensure that 'go build' has work to report.
24
[!GOOS:windows] env GOCACHE=$WORK/gocache
35
[GOOS:windows] env GOCACHE=$WORK\gocache

src/cmd/go/testdata/script/cgo_path.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[short] skip 'runs build'
2+
13
[!cgo] skip
24

35
# Require that CC is something that requires a PATH lookup.

src/cmd/go/testdata/script/clean_cache_n.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[short] skip 'runs go build'
2+
13
# We're testing cache behavior, so start with a clean GOCACHE.
24
env GOCACHE=$WORK/cache
35

src/cmd/go/testdata/script/goauth_userauth.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# This test covers the HTTP authentication mechanism over GOAUTH by using a custom authenticator.
22
# See golang.org/issue/26232
33

4+
[short] skip 'runs build to create authenticators'
5+
46
env GOPROXY=direct
57
env GOSUMDB=off
68
mkdir $WORK/bin

src/cmd/go/testdata/script/test_skip.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[short] skip 'runs test'
2+
13
go test -v -run Test -skip T skip_test.go
24
! stdout RUN
35
stdout '^ok.*\[no tests to run\]'

src/cmd/go/testdata/script/vet_flags.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[short] skip 'runs test'
2+
13
env GO111MODULE=on
24

35
# Issue 35837: "go vet -<analyzer> <std package>" should use the requested

src/cmd/go/testdata/script/work.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[short] skip 'runs go run'
2+
13
! go work init doesnotexist
24
stderr 'go: directory doesnotexist does not exist'
35
go env GOWORK

0 commit comments

Comments
 (0)