mirror of https://github.com/golang/go.git
cmd/go: shorten longest 5 tests
Running go test -parallel=1 -v, these are the top 10 tests: PASS: TestScript/mod_invalid_version 40.14s PASS: TestScript/build_cache_output 46.82s PASS: TestScript/get_legacy 48.69s PASS: TestTestCache 58.44s PASS: TestScript/mod_get_direct 62.88s PASS: TestScript/build_pgo_auto_multi 63.49s PASS: TestScript/build_pgo_auto 70.69s PASS: TestScript/gcflags_patterns 95.17s PASS: TestScript/mod_list_compiled_concurrent 124.31s PASS: TestScript/vet_flags 202.85s Change the top 5 not to run builds at all, so they don't have to use -a or clear the go build cache. mod_get_direct should be replaced with a vcs-test test. mod_invalid_version should be replaced with a vcs-test test. get_legacy should be deleted eventually. Change-Id: Id67c458b1a96c912d89cbece341372c2ef5ee082 Reviewed-on: https://go-review.googlesource.com/c/go/+/504536 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
413e6c0499
commit
36edde9d9f
|
|
@ -3,7 +3,7 @@
|
||||||
[short] skip 'compiles and links executables'
|
[short] skip 'compiles and links executables'
|
||||||
|
|
||||||
# use default.pgo for a single main package
|
# use default.pgo for a single main package
|
||||||
go build -a -x -pgo=auto -o a1.exe ./a/a1
|
go build -n -pgo=auto -o a1.exe ./a/a1
|
||||||
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'
|
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'
|
||||||
|
|
||||||
# check that pgo applied to dependencies
|
# check that pgo applied to dependencies
|
||||||
|
|
@ -12,25 +12,22 @@ stderr 'compile.*-p test/dep.*-pgoprofile=.*default\.pgo'
|
||||||
# check that pgo appears in build info
|
# check that pgo appears in build info
|
||||||
# N.B. we can't start the stdout check with -pgo because the script assumes that
|
# N.B. we can't start the stdout check with -pgo because the script assumes that
|
||||||
# if the first arg starts with - it is a grep flag.
|
# if the first arg starts with - it is a grep flag.
|
||||||
go version -m a1.exe
|
stderr 'build\\t-pgo=.*default\.pgo'
|
||||||
stdout 'build\s+-pgo=.*default\.pgo'
|
|
||||||
|
|
||||||
# use default.pgo for ... with a single main package
|
# use default.pgo for ... with a single main package
|
||||||
go build -a -x -pgo=auto ./a/...
|
go build -n -pgo=auto ./a/...
|
||||||
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'
|
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'
|
||||||
|
|
||||||
# check that pgo appears in build info
|
# check that pgo appears in build info
|
||||||
go version -m a1$GOEXE
|
stderr 'build\\t-pgo=.*default\.pgo'
|
||||||
stdout 'build\s+-pgo=.*default\.pgo'
|
|
||||||
|
|
||||||
# build succeeds without PGO when default.pgo file is absent
|
# build succeeds without PGO when default.pgo file is absent
|
||||||
go build -a -x -pgo=auto -o nopgo.exe ./nopgo
|
go build -n -pgo=auto -o nopgo.exe ./nopgo
|
||||||
stderr 'compile.*nopgo.go'
|
stderr 'compile.*nopgo.go'
|
||||||
! stderr 'compile.*-pgoprofile'
|
! stderr 'compile.*-pgoprofile'
|
||||||
|
|
||||||
# check that pgo doesn't appear in build info
|
# check that pgo doesn't appear in build info
|
||||||
go version -m nopgo.exe
|
! stderr 'build\\t-pgo='
|
||||||
! stdout 'build\s+-pgo='
|
|
||||||
|
|
||||||
# other build-related commands
|
# other build-related commands
|
||||||
go install -a -n -pgo=auto ./a/a1
|
go install -a -n -pgo=auto ./a/a1
|
||||||
|
|
@ -52,30 +49,27 @@ go list -deps -pgo=auto ./a/a1
|
||||||
|
|
||||||
# -pgo=auto is the default. Commands without explicit -pgo=auto
|
# -pgo=auto is the default. Commands without explicit -pgo=auto
|
||||||
# should work as -pgo=auto.
|
# should work as -pgo=auto.
|
||||||
go build -a -x -o a1.exe ./a/a1
|
go build -a -n -o a1.exe ./a/a1
|
||||||
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'
|
stderr 'compile.*-pgoprofile=.*default\.pgo.*a1.go'
|
||||||
stderr 'compile.*-p test/dep.*-pgoprofile=.*default\.pgo'
|
stderr 'compile.*-p test/dep.*-pgoprofile=.*default\.pgo'
|
||||||
|
|
||||||
# check that pgo appears in build info
|
# check that pgo appears in build info
|
||||||
go version -m a1.exe
|
stderr 'build\\t-pgo=.*default\.pgo'
|
||||||
stdout 'build\s+-pgo=.*default\.pgo'
|
|
||||||
|
|
||||||
go build -a -x -o nopgo.exe ./nopgo
|
go build -a -n -o nopgo.exe ./nopgo
|
||||||
stderr 'compile.*nopgo.go'
|
stderr 'compile.*nopgo.go'
|
||||||
! stderr 'compile.*-pgoprofile'
|
! stderr 'compile.*-pgoprofile'
|
||||||
|
|
||||||
# check that pgo doesn't appear in build info
|
# check that pgo doesn't appear in build info
|
||||||
go version -m nopgo.exe
|
! stderr 'build\\t-pgo='
|
||||||
! stdout 'build\s+-pgo='
|
|
||||||
|
|
||||||
# -pgo=off should turn off PGO.
|
# -pgo=off should turn off PGO.
|
||||||
go build -a -x -pgo=off -o a1.exe ./a/a1
|
go build -a -n -pgo=off -o a1.exe ./a/a1
|
||||||
stderr 'compile.*a1.go'
|
stderr 'compile.*a1.go'
|
||||||
! stderr 'compile.*-pgoprofile'
|
! stderr 'compile.*-pgoprofile'
|
||||||
|
|
||||||
# check that pgo doesn't appear in build info
|
# check that pgo doesn't appear in build info
|
||||||
go version -m a1.exe
|
! stderr 'build\\t-pgo='
|
||||||
! stdout 'build\s+-pgo='
|
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
module test
|
module test
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
# Test go build -pgo=auto flag with multiple main packages.
|
# Test go build -pgo=auto flag with multiple main packages.
|
||||||
|
|
||||||
[short] skip 'compiles and links executables'
|
go install -a -n -pgo=auto ./a ./b ./nopgo
|
||||||
|
|
||||||
env GOBIN=$WORK/bin
|
|
||||||
go install -a -x -pgo=auto ./a ./b ./nopgo
|
|
||||||
|
|
||||||
# a/default.pgo applies to package a and (transitive)
|
# a/default.pgo applies to package a and (transitive)
|
||||||
# dependencies.
|
# dependencies.
|
||||||
|
|
@ -36,16 +33,9 @@ stderr -count=3 'compile.*dep3(/|\\\\)dep3.go'
|
||||||
stderr -count=2 'compile.*-pgoprofile=.*dep3(/|\\\\)dep3\.go'
|
stderr -count=2 'compile.*-pgoprofile=.*dep3(/|\\\\)dep3\.go'
|
||||||
|
|
||||||
# check that pgo appears or not in build info as expected
|
# check that pgo appears or not in build info as expected
|
||||||
# N.B. we can't start the stdout check with -pgo because the script assumes that
|
stderr 'path\\ttest/a\\n.*build\\t-pgo=.*a(/|\\\\)default\.pgo'
|
||||||
# if the first arg starts with - it is a grep flag.
|
stderr 'path\\ttest/b\\n.*build\\t-pgo=.*b(/|\\\\)default\.pgo'
|
||||||
go version -m $GOBIN/a$GOEXE
|
! stderr 'path\\ttest/nopgo\\n.*build\\t-pgo='
|
||||||
stdout 'build\s+-pgo=.*a'${/}'default\.pgo'
|
|
||||||
|
|
||||||
go version -m $GOBIN/b$GOEXE
|
|
||||||
stdout 'build\s+-pgo=.*b'${/}'default\.pgo'
|
|
||||||
|
|
||||||
go version -m $GOBIN/nopgo$GOEXE
|
|
||||||
! stdout 'build\s+-pgo='
|
|
||||||
|
|
||||||
# go test works the same way
|
# go test works the same way
|
||||||
go test -a -n -pgo=auto ./a ./b ./nopgo
|
go test -a -n -pgo=auto ./a ./b ./nopgo
|
||||||
|
|
|
||||||
|
|
@ -3,17 +3,15 @@ env GO111MODULE=off
|
||||||
[!compiler:gc] skip 'using -gcflags and -ldflags'
|
[!compiler:gc] skip 'using -gcflags and -ldflags'
|
||||||
[short] skip
|
[short] skip
|
||||||
|
|
||||||
env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
|
|
||||||
|
|
||||||
# -gcflags=-e applies to named packages, not dependencies
|
# -gcflags=-e applies to named packages, not dependencies
|
||||||
go build -n -v -gcflags=-e z1 z2
|
go build -a -n -v -gcflags=-e z1 z2
|
||||||
stderr 'compile.* -p z1.* -e '
|
stderr 'compile.* -p z1.* -e '
|
||||||
stderr 'compile.* -p z2.* -e '
|
stderr 'compile.* -p z2.* -e '
|
||||||
stderr 'compile.* -p y'
|
stderr 'compile.* -p y'
|
||||||
! stderr 'compile.* -p [^z].* -e '
|
! stderr 'compile.* -p [^z].* -e '
|
||||||
|
|
||||||
# -gcflags can specify package=flags, and can be repeated; last match wins
|
# -gcflags can specify package=flags, and can be repeated; last match wins
|
||||||
go build -n -v -gcflags=-e -gcflags=z1=-N z1 z2
|
go build -a -n -v -gcflags=-e -gcflags=z1=-N z1 z2
|
||||||
stderr 'compile.* -p z1.* -N '
|
stderr 'compile.* -p z1.* -N '
|
||||||
! stderr 'compile.* -p z1.* -e '
|
! stderr 'compile.* -p z1.* -e '
|
||||||
! stderr 'compile.* -p z2.* -N '
|
! stderr 'compile.* -p z2.* -N '
|
||||||
|
|
@ -23,11 +21,11 @@ stderr 'compile.* -p y'
|
||||||
! stderr 'compile.* -p [^z].* -N '
|
! stderr 'compile.* -p [^z].* -N '
|
||||||
|
|
||||||
# -gcflags can have arbitrary spaces around the flags
|
# -gcflags can have arbitrary spaces around the flags
|
||||||
go build -n -v -gcflags=' z1 = -e ' z1
|
go build -a -n -v -gcflags=' z1 = -e ' z1
|
||||||
stderr 'compile.* -p z1.* -e '
|
stderr 'compile.* -p z1.* -e '
|
||||||
|
|
||||||
# -gcflags='all=-e' should apply to all packages, even with go test
|
# -gcflags='all=-e' should apply to all packages, even with go test
|
||||||
go test -c -n -gcflags='all=-e' z1
|
go test -a -c -n -gcflags='all=-e' z1
|
||||||
stderr 'compile.* -p z3.* -e '
|
stderr 'compile.* -p z3.* -e '
|
||||||
|
|
||||||
# this particular -gcflags argument made the compiler crash
|
# this particular -gcflags argument made the compiler crash
|
||||||
|
|
@ -39,31 +37,31 @@ stderr 'PhaseOptions usage'
|
||||||
stderr 'invalid value'
|
stderr 'invalid value'
|
||||||
|
|
||||||
# -ldflags for implicit test package applies to test binary
|
# -ldflags for implicit test package applies to test binary
|
||||||
go test -c -n -gcflags=-N -ldflags=-X=x.y=z z1
|
go test -a -c -n -gcflags=-N -ldflags=-X=x.y=z z1
|
||||||
stderr 'compile.* -N .*z_test.go'
|
stderr 'compile.* -N .*z_test.go'
|
||||||
stderr 'link.* -X=x.y=z'
|
stderr 'link.* -X=x.y=z'
|
||||||
|
|
||||||
# -ldflags for explicit test package applies to test binary
|
# -ldflags for explicit test package applies to test binary
|
||||||
go test -c -n -gcflags=z1=-N -ldflags=z1=-X=x.y=z z1
|
go test -a -c -n -gcflags=z1=-N -ldflags=z1=-X=x.y=z z1
|
||||||
stderr 'compile.* -N .*z_test.go'
|
stderr 'compile.* -N .*z_test.go'
|
||||||
stderr 'link.* -X=x.y=z'
|
stderr 'link.* -X=x.y=z'
|
||||||
|
|
||||||
# -ldflags applies to link of command
|
# -ldflags applies to link of command
|
||||||
go build -n -ldflags=-X=math.pi=3 my/cmd/prog
|
go build -a -n -ldflags=-X=math.pi=3 my/cmd/prog
|
||||||
stderr 'link.* -X=math.pi=3'
|
stderr 'link.* -X=math.pi=3'
|
||||||
|
|
||||||
# -ldflags applies to link of command even with strange directory name
|
# -ldflags applies to link of command even with strange directory name
|
||||||
go build -n -ldflags=-X=math.pi=3 my/cmd/prog/
|
go build -a -n -ldflags=-X=math.pi=3 my/cmd/prog/
|
||||||
stderr 'link.* -X=math.pi=3'
|
stderr 'link.* -X=math.pi=3'
|
||||||
|
|
||||||
# -ldflags applies to current directory
|
# -ldflags applies to current directory
|
||||||
cd my/cmd/prog
|
cd my/cmd/prog
|
||||||
go build -n -ldflags=-X=math.pi=3
|
go build -a -n -ldflags=-X=math.pi=3
|
||||||
stderr 'link.* -X=math.pi=3'
|
stderr 'link.* -X=math.pi=3'
|
||||||
|
|
||||||
# -ldflags applies to current directory even if GOPATH is funny
|
# -ldflags applies to current directory even if GOPATH is funny
|
||||||
[!case-sensitive] cd $WORK/GoPath/src/my/cmd/prog
|
[!case-sensitive] cd $WORK/GoPath/src/my/cmd/prog
|
||||||
go build -n -ldflags=-X=math.pi=3
|
go build -a -n -ldflags=-X=math.pi=3
|
||||||
stderr 'link.* -X=math.pi=3'
|
stderr 'link.* -X=math.pi=3'
|
||||||
|
|
||||||
# cgo.a should not be a dependency of internally-linked go package
|
# cgo.a should not be a dependency of internally-linked go package
|
||||||
|
|
|
||||||
|
|
@ -5,33 +5,12 @@ env GO111MODULE=on
|
||||||
|
|
||||||
# Regression test for golang.org/issue/29667:
|
# Regression test for golang.org/issue/29667:
|
||||||
# spurious 'failed to cache compiled Go files' errors.
|
# spurious 'failed to cache compiled Go files' errors.
|
||||||
# This test failed reliably when run with -count=10
|
|
||||||
# on a Linux workstation.
|
|
||||||
|
|
||||||
env GOCACHE=$WORK/gocache
|
env GOCACHE=$WORK/gocache
|
||||||
mkdir $GOCACHE
|
mkdir $GOCACHE
|
||||||
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
go list -json -compiled -test=false -export=false -deps=true -- . &
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
go list -json -compiled -test=false -export=false -deps=true -- . &
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
go list -json -compiled -test=false -export=false -deps=true -- . &
|
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
|
|
|
||||||
|
|
@ -52,27 +52,25 @@ env GOFLAGS='-unsafeptr'
|
||||||
stderr 'go: parsing \$GOFLAGS: unknown flag -unsafeptr'
|
stderr 'go: parsing \$GOFLAGS: unknown flag -unsafeptr'
|
||||||
env GOFLAGS=
|
env GOFLAGS=
|
||||||
|
|
||||||
env GOCACHE=$WORK/gocache
|
|
||||||
|
|
||||||
# "go test" on a user package should by default enable an explicit list of analyzers.
|
# "go test" on a user package should by default enable an explicit list of analyzers.
|
||||||
go test -x -run=none .
|
go test -n -run=none .
|
||||||
stderr '[/\\]vet'$GOEXE'["]? .* -errorsas .* ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
stderr '[/\\]vet'$GOEXE'["]? .* -errorsas .* ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
||||||
|
|
||||||
# An explicitly-empty -vet argument should imply the default analyzers.
|
# An explicitly-empty -vet argument should imply the default analyzers.
|
||||||
go test -x -vet= -run=none .
|
go test -n -vet= -run=none .
|
||||||
stderr '[/\\]vet'$GOEXE'["]? .* -errorsas .* ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
stderr '[/\\]vet'$GOEXE'["]? .* -errorsas .* ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
||||||
|
|
||||||
# "go test" on a standard package should by default disable an explicit list.
|
# "go test" on a standard package should by default disable an explicit list.
|
||||||
go test -x -run=none encoding/binary
|
go test -n -run=none encoding/binary
|
||||||
stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
||||||
|
|
||||||
go test -x -vet= -run=none encoding/binary
|
go test -n -vet= -run=none encoding/binary
|
||||||
stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
stderr '[/\\]vet'$GOEXE'["]? -unsafeptr=false -unreachable=false ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
||||||
|
|
||||||
# Both should allow users to override via the -vet flag.
|
# Both should allow users to override via the -vet flag.
|
||||||
go test -x -vet=unreachable -run=none .
|
go test -n -vet=unreachable -run=none .
|
||||||
stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
||||||
go test -x -vet=unreachable -run=none encoding/binary
|
go test -n -vet=unreachable -run=none encoding/binary
|
||||||
stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
stderr '[/\\]vet'$GOEXE'["]? -unreachable ["]?\$WORK[/\\][^ ]*[/\\]vet\.cfg'
|
||||||
|
|
||||||
-- go.mod --
|
-- go.mod --
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue