]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: skip some tests that run builds in short mode
authorMichael Matloob <matloob@golang.org>
Fri, 28 Feb 2025 21:57:44 +0000 (16:57 -0500)
committerMichael Matloob <matloob@golang.org>
Wed, 5 Mar 2025 18:23:35 +0000 (10:23 -0800)
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 <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/go_test.go
src/cmd/go/note_test.go
src/cmd/go/testdata/script/build_GOTMPDIR.txt
src/cmd/go/testdata/script/cgo_path.txt
src/cmd/go/testdata/script/clean_cache_n.txt
src/cmd/go/testdata/script/goauth_userauth.txt
src/cmd/go/testdata/script/test_skip.txt
src/cmd/go/testdata/script/vet_flags.txt
src/cmd/go/testdata/script/work.txt

index 1df7cf8faa8b01821bd1cdecf9d5ddc204f962c8..84e4b7abea9cf120f3ad57bb12d43ef1b39a8798 100644 (file)
@@ -1147,6 +1147,8 @@ func TestGoListCompiledCgo(t *testing.T) {
 }
 
 func TestGoListExport(t *testing.T) {
+       tooSlow(t, "runs build for -export")
+
        skipIfGccgo(t, "gccgo does not have standard packages")
        tg := testgo(t)
        defer tg.cleanup()
index ba7ec2a47bcc43f5faaaf3f6b489b66b32b6e1e0..3b8751b4db16152e8170d6dfd4e6b2ac94b16909 100644 (file)
@@ -13,6 +13,8 @@ import (
 )
 
 func TestNoteReading(t *testing.T) {
+       tooSlow(t, "runs build")
+
        // cmd/internal/buildid already has tests that the basic reading works.
        // This test is essentially checking that -ldflags=-buildid=XXX works,
        // both in internal and external linking mode.
index 4c9129ec45c5ddc58fd2fd7dd892a74ed72ae2c9..6ad0157e5f629b79d8add3abc34ab2295c2823e6 100644 (file)
@@ -1,3 +1,5 @@
+[short] skip 'runs build'
+
 # Set GOCACHE to a clean directory to ensure that 'go build' has work to report.
 [!GOOS:windows] env GOCACHE=$WORK/gocache
 [GOOS:windows] env GOCACHE=$WORK\gocache
index be23893df59863ddf5e20cd0ff4c50bdcd51316e..0c8838e35459f4b3baa9bcaaf6cb7f7bd6694b19 100644 (file)
@@ -1,3 +1,5 @@
+[short] skip 'runs build'
+
 [!cgo] skip
 
 # Require that CC is something that requires a PATH lookup.
index 72f9abf9ae1c821e447b4ce169c0f50fbf419cb6..b93134e6bb4db3dd8ab26efd3a1559b204c1d126 100644 (file)
@@ -1,3 +1,5 @@
+[short] skip 'runs go build'
+
 # We're testing cache behavior, so start with a clean GOCACHE.
 env GOCACHE=$WORK/cache
 
index 036573e07a2a3ff733ba93fee35146d96d5f45b2..f70933cf585753e41bd602d4da248d2ea3b28b29 100644 (file)
@@ -1,6 +1,8 @@
 # This test covers the HTTP authentication mechanism over GOAUTH by using a custom authenticator.
 # See golang.org/issue/26232
 
+[short] skip 'runs build to create authenticators'
+
 env GOPROXY=direct
 env GOSUMDB=off
 mkdir $WORK/bin
index 2e5f4d65d7028b5020b7e18c4d382c8534e38b14..350becbb20cc9f6c61bd5f56ef6e6e384af66207 100644 (file)
@@ -1,3 +1,5 @@
+[short] skip 'runs test'
+
 go test -v -run Test -skip T skip_test.go
 ! stdout RUN
 stdout '^ok.*\[no tests to run\]'
index 73f4e4135bfcb3be9dff0f5b6af54f8e09d5b1d4..21606dc4f1dfc83b45093c5132d6cb5f2f6f48a4 100644 (file)
@@ -1,3 +1,5 @@
+[short] skip 'runs test'
+
 env GO111MODULE=on
 
 # Issue 35837: "go vet -<analyzer> <std package>" should use the requested
index 28df1a008c17ee28e3ca48155d97c7a6c75dbe67..31597928689552abaf79af4604caf4942c5f76cd 100644 (file)
@@ -1,3 +1,5 @@
+[short] skip 'runs go run'
+
 ! go work init doesnotexist
 stderr 'go: directory doesnotexist does not exist'
 go env GOWORK