mirror of
https://github.com/golang/go
synced 2024-11-12 02:00:23 -07:00
cmd/go: cut 'go test -short cmd/go' time by about half
Was 50 seconds on unloaded Mac laptop; now 27. Still longer than I would like, but every little bit helps. For #26473. Change-Id: Id4be016ee1555cbc3512eca0ae10236d7f06bd02 Reviewed-on: https://go-review.googlesource.com/c/go/+/177398 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
0c47e24df8
commit
dccd5da08e
@ -1898,6 +1898,7 @@ func TestGoListTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGoListCompiledCgo(t *testing.T) {
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -2537,6 +2538,7 @@ func TestCoverageRuns(t *testing.T) {
|
||||
|
||||
func TestCoverageDotImport(t *testing.T) {
|
||||
skipIfGccgo(t, "gccgo has no cover tool")
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -2716,6 +2718,7 @@ func TestCoverageFunc(t *testing.T) {
|
||||
// Issue 24588.
|
||||
func TestCoverageDashC(t *testing.T) {
|
||||
skipIfGccgo(t, "gccgo has no cover tool")
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -3391,6 +3394,7 @@ func TestVetWithOnlyCgoFiles(t *testing.T) {
|
||||
if !canCgo {
|
||||
t.Skip("skipping because cgo not enabled")
|
||||
}
|
||||
tooSlow(t)
|
||||
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
@ -5654,6 +5658,7 @@ func TestTestSkipVetAfterFailedBuild(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTestVetRebuild(t *testing.T) {
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -5933,6 +5938,7 @@ func TestBadCgoDirectives(t *testing.T) {
|
||||
if !canCgo {
|
||||
t.Skip("no cgo")
|
||||
}
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
|
||||
@ -6047,6 +6053,7 @@ func TestTwoPkgConfigs(t *testing.T) {
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
|
||||
t.Skipf("no shell scripts on %s", runtime.GOOS)
|
||||
}
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -6077,6 +6084,8 @@ func TestCgoCache(t *testing.T) {
|
||||
if !canCgo {
|
||||
t.Skip("no cgo")
|
||||
}
|
||||
tooSlow(t)
|
||||
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -6127,6 +6136,7 @@ func TestLinkerTmpDirIsDeleted(t *testing.T) {
|
||||
if !canCgo {
|
||||
t.Skip("skipping because cgo not enabled")
|
||||
}
|
||||
tooSlow(t)
|
||||
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
@ -6216,6 +6226,7 @@ func TestGoTestWithoutTests(t *testing.T) {
|
||||
|
||||
// Issue 25579.
|
||||
func TestGoBuildDashODevNull(t *testing.T) {
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
@ -6228,6 +6239,7 @@ func TestGoBuildDashODevNull(t *testing.T) {
|
||||
// Issue 25093.
|
||||
func TestCoverpkgTestOnly(t *testing.T) {
|
||||
skipIfGccgo(t, "gccgo has no cover tool")
|
||||
tooSlow(t)
|
||||
tg := testgo(t)
|
||||
defer tg.cleanup()
|
||||
tg.parallel()
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# Set GOCACHE to a clean directory to ensure that 'go build' has work to report.
|
||||
env GOCACHE=$WORK/gocache
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# Set up fresh GOCACHE.
|
||||
env GOCACHE=$WORK/gocache
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip # rebuilds std for mips
|
||||
|
||||
# Set up fresh GOCACHE.
|
||||
env GOCACHE=$WORK/gocache
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# Set up fresh GOCACHE.
|
||||
env GOCACHE=$WORK/gocache
|
||||
|
@ -1,6 +1,7 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip
|
||||
[short] skip # clears cache, rebuilds too much
|
||||
|
||||
# Set up fresh GOCACHE.
|
||||
env GOCACHE=$WORK/gocache
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip # rebuilds all of std
|
||||
|
||||
# Set up fresh GOCACHE.
|
||||
env GOCACHE=$WORK/gocache
|
||||
|
@ -1,3 +1,5 @@
|
||||
[short] skip
|
||||
|
||||
env -r GOROOT_REGEXP=$GOROOT
|
||||
env -r WORK_REGEXP=$WORK
|
||||
env GOROOT GOROOT_REGEXP WORK WORK_REGEXP
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# This test tests that we can link in-package syso files that provides symbols
|
||||
# for cgo. See issue 29253.
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# go clean -testcache
|
||||
# should work (see golang.org/issue/29757).
|
||||
|
@ -1,6 +1,7 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip 'using -gcflags and -ldflags'
|
||||
[short] skip
|
||||
|
||||
# -gcflags=-e applies to named packages, not dependencies
|
||||
go build -n -v -gcflags=-e z1 z2
|
||||
|
1
src/cmd/go/testdata/script/get_dotfiles.txt
vendored
1
src/cmd/go/testdata/script/get_dotfiles.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
[!exec:git] skip
|
||||
|
||||
|
1
src/cmd/go/testdata/script/get_tilde.txt
vendored
1
src/cmd/go/testdata/script/get_tilde.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# Paths containing windows short names should be rejected before attempting to fetch.
|
||||
! go get example.com/longna~1.dir/thing
|
||||
|
1
src/cmd/go/testdata/script/get_unicode.txt
vendored
1
src/cmd/go/testdata/script/get_unicode.txt
vendored
@ -1,6 +1,7 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!exec:git] skip
|
||||
[short] skip
|
||||
|
||||
# Construct a repository that imports a non-ASCII path.
|
||||
cd $WORK/_origin/example.com/unicode
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# 'go install' with no arguments should clean up after go build
|
||||
cd mycmd
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[!short] skip # rebuilds std for alternate architecture
|
||||
|
||||
cd mycmd
|
||||
go build mycmd
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=off
|
||||
[short] skip
|
||||
|
||||
# This test matches mod_list_bad_import, but in GOPATH mode.
|
||||
# Please keep them in sync.
|
||||
|
1
src/cmd/go/testdata/script/list_find.txt
vendored
1
src/cmd/go/testdata/script/list_find.txt
vendored
@ -12,6 +12,7 @@ stdout '^false \[\]'
|
||||
# should be identical. "go build" derives action IDs (which are used as cache
|
||||
# keys) from dependencies' action IDs. "go list -find" won't know what the
|
||||
# dependencies are, so it's can't construct the same action IDs.
|
||||
[short] skip
|
||||
go list -find -compiled net
|
||||
go list -find -compiled -x net
|
||||
! stderr 'cgo'
|
||||
|
2
src/cmd/go/testdata/script/list_std.txt
vendored
2
src/cmd/go/testdata/script/list_std.txt
vendored
@ -1,12 +1,12 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip
|
||||
[short] skip
|
||||
|
||||
# Listing GOROOT should only find standard packages.
|
||||
cd $GOROOT/src
|
||||
go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./...
|
||||
! stdout .
|
||||
# TODO: ignore _/blah/go/src in output
|
||||
|
||||
# Standard packages should include cmd, but not cmd/vendor.
|
||||
go list ./...
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
go get -m rsc.io/fortune/v2
|
||||
|
||||
|
1
src/cmd/go/testdata/script/mod_doc.txt
vendored
1
src/cmd/go/testdata/script/mod_doc.txt
vendored
@ -1,6 +1,7 @@
|
||||
# go doc should find module documentation
|
||||
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
go doc y
|
||||
stdout 'Package y is.*alphabet'
|
||||
|
1
src/cmd/go/testdata/script/mod_download.txt
vendored
1
src/cmd/go/testdata/script/mod_download.txt
vendored
@ -10,6 +10,7 @@ exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.mod
|
||||
exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.5.0.zip
|
||||
|
||||
# download of an invalid path should report the error
|
||||
[short] skip
|
||||
! go mod download this.domain.is.invalid/somemodule@v1.0.0
|
||||
stderr 'this.domain.is.invalid'
|
||||
! go mod download -json this.domain.is.invalid/somemodule@v1.0.0
|
||||
|
@ -1,3 +1,5 @@
|
||||
[short] skip
|
||||
|
||||
# Allow (cached) downloads for -mod=readonly.
|
||||
env GO111MODULE=on
|
||||
env GOPATH=$WORK/gopath1
|
||||
|
@ -1,11 +1,12 @@
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=$GOPROXY/quiet
|
||||
[short] skip
|
||||
|
||||
# @commit should resolve
|
||||
|
||||
# golang.org/x/text/language@commit should not resolve with -m,
|
||||
# because that's not a module path.
|
||||
! go get -m golang.org/x/text/language@14c0d48
|
||||
! go get -d -m golang.org/x/text/language@14c0d48
|
||||
|
||||
# ... but it should work without -m.
|
||||
# because of -d, the compiler should not run
|
||||
@ -13,12 +14,13 @@ go get -d -x golang.org/x/text/language@14c0d48
|
||||
! stderr 'compile|cp|gccgo .*language\.a$'
|
||||
|
||||
# go get should skip build with no Go files in root
|
||||
go get golang.org/x/text@14c0d48
|
||||
go get -d golang.org/x/text@14c0d48
|
||||
|
||||
# ... and go get should skip build with -m
|
||||
go get -m golang.org/x/text@14c0d48
|
||||
|
||||
# dropping -d, we should see a build.
|
||||
[short] skip
|
||||
go get -x golang.org/x/text/language@14c0d48
|
||||
stderr 'compile|cp|gccgo .*language\.a$'
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# downgrade sampler should downgrade quote
|
||||
go get rsc.io/sampler@v1.0.0
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# get -u should not upgrade anything, since the package
|
||||
# in the current directory doesn't import anything.
|
||||
|
1
src/cmd/go/testdata/script/mod_get_local.txt
vendored
1
src/cmd/go/testdata/script/mod_get_local.txt
vendored
@ -1,4 +1,5 @@
|
||||
# Test 'go get' with a local module with a name that is not valid for network lookup.
|
||||
[short] skip
|
||||
|
||||
env GO111MODULE=on
|
||||
go mod edit -fmt
|
||||
|
1
src/cmd/go/testdata/script/mod_get_main.txt
vendored
1
src/cmd/go/testdata/script/mod_get_main.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# @patch and @latest within the main module refer to the current version.
|
||||
# The main module won't be upgraded, but missing dependencies will be added.
|
||||
|
1
src/cmd/go/testdata/script/mod_get_moved.txt
vendored
1
src/cmd/go/testdata/script/mod_get_moved.txt
vendored
@ -1,5 +1,6 @@
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=$GOPROXY/quiet
|
||||
[short] skip
|
||||
|
||||
# A 'go get' that worked at a previous version should continue to work at that version,
|
||||
# even if the package was subsequently moved into a submodule.
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# If a pattern doesn't match any modules in the build list,
|
||||
# and -m is used, an error should be reported.
|
||||
|
12
src/cmd/go/testdata/script/mod_get_upgrade.txt
vendored
12
src/cmd/go/testdata/script/mod_get_upgrade.txt
vendored
@ -6,30 +6,30 @@ stdout 'rsc.io/quote v1.5.1'
|
||||
grep 'rsc.io/quote v1.5.1$' go.mod
|
||||
|
||||
# get -m -u should update all dependencies
|
||||
go get -m -u
|
||||
go get -d -m -u
|
||||
grep 'rsc.io/quote v1.5.2$' go.mod
|
||||
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
|
||||
|
||||
# get -u rsc.io/sampler should update only sampler's dependencies
|
||||
cp go.mod-v1.5.1 go.mod
|
||||
go get -u rsc.io/sampler
|
||||
go get -d -u rsc.io/sampler
|
||||
grep 'rsc.io/quote v1.5.1$' go.mod
|
||||
grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
|
||||
|
||||
# move to a pseudo-version after any tags
|
||||
go get -m rsc.io/quote@dd9747d
|
||||
go get -d -m rsc.io/quote@dd9747d
|
||||
grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod
|
||||
|
||||
# get -u should not jump off newer pseudo-version to earlier tag
|
||||
go get -m -u
|
||||
go get -d -m -u
|
||||
grep 'rsc.io/quote v0.0.0-20180628003336-dd9747d19b04' go.mod
|
||||
|
||||
# move to earlier pseudo-version
|
||||
go get -m rsc.io/quote@e7a685a342
|
||||
go get -d -m rsc.io/quote@e7a685a342
|
||||
grep 'rsc.io/quote v0.0.0-20180214005133-e7a685a342c0' go.mod
|
||||
|
||||
# get -u should jump off earlier pseudo-version to newer tag
|
||||
go get -m -u
|
||||
go get -d -m -u
|
||||
grep 'rsc.io/quote v1.5.2' go.mod
|
||||
|
||||
-- go.mod --
|
||||
|
@ -1,3 +1,5 @@
|
||||
[short] skip
|
||||
|
||||
# go/build's Import should find modules by invoking the go command
|
||||
|
||||
go build -o $WORK/testimport.exe ./testimport
|
||||
|
1
src/cmd/go/testdata/script/mod_internal.txt
vendored
1
src/cmd/go/testdata/script/mod_internal.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# golang.org/x/internal should be importable from other golang.org/x modules.
|
||||
rm go.mod
|
||||
|
1
src/cmd/go/testdata/script/mod_list.txt
vendored
1
src/cmd/go/testdata/script/mod_list.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir.
|
||||
go list -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all
|
||||
|
2
src/cmd/go/testdata/script/mod_list_dir.txt
vendored
2
src/cmd/go/testdata/script/mod_list_dir.txt
vendored
@ -1,3 +1,5 @@
|
||||
[short] skip
|
||||
|
||||
# go list with path to directory should work
|
||||
|
||||
env GO111MODULE=off
|
||||
|
1
src/cmd/go/testdata/script/mod_list_std.txt
vendored
1
src/cmd/go/testdata/script/mod_list_std.txt
vendored
@ -2,6 +2,7 @@ env GO111MODULE=on
|
||||
env GOPROXY=off
|
||||
|
||||
[!gc] skip
|
||||
[short] skip
|
||||
|
||||
# Outside of GOROOT, our vendored packages should be reported as part of the standard library.
|
||||
go list -f '{{if .Standard}}{{.ImportPath}}{{end}}' std cmd
|
||||
|
1
src/cmd/go/testdata/script/mod_outside.txt
vendored
1
src/cmd/go/testdata/script/mod_outside.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# This script tests commands in module mode outside of any module.
|
||||
#
|
||||
|
11
src/cmd/go/testdata/script/mod_patterns.txt
vendored
11
src/cmd/go/testdata/script/mod_patterns.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
cd m
|
||||
|
||||
@ -29,10 +30,6 @@ stdout 'cmd/pprof: \[\.\.\.\]'
|
||||
|
||||
stderr -count=1 '^go: warning: "./xyz..." matched no packages$'
|
||||
|
||||
env CGO_ENABLED=0
|
||||
go list -f '{{.ImportPath}}: {{.Match}}' all ... example.com/m/... ./... ./xyz...
|
||||
! stdout example.com/m/useC
|
||||
|
||||
# 'go list ./...' should not try to resolve the main module.
|
||||
cd ../empty
|
||||
go list -deps ./...
|
||||
@ -40,6 +37,12 @@ go list -deps ./...
|
||||
! stderr 'finding'
|
||||
stderr -count=1 '^go: warning: "./..." matched no packages'
|
||||
|
||||
# disabling cgo should drop useC
|
||||
[short] skip
|
||||
env CGO_ENABLED=0
|
||||
go list -f '{{.ImportPath}}: {{.Match}}' all ... example.com/m/... ./... ./xyz...
|
||||
! stdout example.com/m/useC
|
||||
|
||||
-- m/go.mod --
|
||||
module example.com/m
|
||||
|
||||
|
1
src/cmd/go/testdata/script/mod_readonly.txt
vendored
1
src/cmd/go/testdata/script/mod_readonly.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# -mod=readonly must not resolve missing modules nor update go.mod
|
||||
#
|
||||
|
1
src/cmd/go/testdata/script/mod_replace.txt
vendored
1
src/cmd/go/testdata/script/mod_replace.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
cp go.mod go.mod.orig
|
||||
|
||||
|
25
src/cmd/go/testdata/script/mod_test.txt
vendored
25
src/cmd/go/testdata/script/mod_test.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# TODO(bcmills): Convert the 'go test' calls below to 'go list -test' once 'go
|
||||
# list' is more sensitive to package loading errors.
|
||||
@ -6,8 +7,8 @@ env GO111MODULE=on
|
||||
# A test in the module's root package should work.
|
||||
cd a/
|
||||
cp go.mod.empty go.mod
|
||||
go test
|
||||
stdout PASS
|
||||
go list -test
|
||||
! stderr error
|
||||
|
||||
cp go.mod.empty go.mod
|
||||
go list -deps
|
||||
@ -33,27 +34,27 @@ go list -test all
|
||||
stdout '^testing'
|
||||
|
||||
cp go.mod.empty go.mod
|
||||
go test
|
||||
stdout PASS
|
||||
go list -test
|
||||
! stderr error
|
||||
|
||||
# A test with the "_test" suffix in the module root should also work.
|
||||
cd ../b/
|
||||
go test
|
||||
stdout PASS
|
||||
go list -test
|
||||
! stderr error
|
||||
|
||||
# A test with the "_test" suffix of a *package* with a "_test" suffix should
|
||||
# even work (not that you should ever do that).
|
||||
cd ../c_test
|
||||
go test
|
||||
stdout PASS
|
||||
go list -test
|
||||
! stderr error
|
||||
|
||||
cd ../d_test
|
||||
go test
|
||||
stdout PASS
|
||||
go list -test
|
||||
! stderr error
|
||||
|
||||
cd ../e
|
||||
go test
|
||||
stdout PASS
|
||||
go list -test
|
||||
! stderr error
|
||||
|
||||
-- a/go.mod.empty --
|
||||
module example.com/user/a
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# golang.org/issue/30166: 'go mod tidy' should not crash if a replaced module is
|
||||
# involved in a cycle.
|
||||
|
4
src/cmd/go/testdata/script/mod_tidy_sum.txt
vendored
4
src/cmd/go/testdata/script/mod_tidy_sum.txt
vendored
@ -1,12 +1,12 @@
|
||||
env GO111MODULE=on
|
||||
|
||||
# go.sum should list directly used modules and dependencies
|
||||
go get rsc.io/quote@v1.5.2
|
||||
go get -d rsc.io/quote@v1.5.2
|
||||
go mod tidy
|
||||
grep rsc.io/sampler go.sum
|
||||
|
||||
# go.sum should not normally lose old entries
|
||||
go get rsc.io/quote@v1.0.0
|
||||
go get -d rsc.io/quote@v1.0.0
|
||||
grep 'rsc.io/quote v1.0.0' go.sum
|
||||
grep 'rsc.io/quote v1.5.2' go.sum
|
||||
grep rsc.io/sampler go.sum
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# Initially, we are at v1.0.0 for all dependencies.
|
||||
cp go.mod go.mod.orig
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# Initially, we are at v1.0.0 for all dependencies.
|
||||
cp go.mod go.mod.orig
|
||||
@ -11,7 +12,7 @@ stdout '^patch.example.com/indirect v1.0.0'
|
||||
# of the package in the current directory, pulling in transitive dependencies
|
||||
# and also patching those.
|
||||
cp go.mod.orig go.mod
|
||||
go get -u=patch
|
||||
go get -d -u=patch
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.0.1'
|
||||
stdout '^patch.example.com/indirect v1.0.1'
|
||||
@ -19,7 +20,7 @@ stdout '^patch.example.com/depofdirectpatch v1.0.0'
|
||||
|
||||
# 'get all@patch' should be equivalent to 'get -u=patch all'
|
||||
cp go.mod.orig go.mod
|
||||
go get all@patch
|
||||
go get -d all@patch
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.0.1'
|
||||
stdout '^patch.example.com/indirect v1.0.1'
|
||||
@ -28,7 +29,7 @@ stdout '^patch.example.com/depofdirectpatch v1.0.0'
|
||||
# Requesting the direct dependency with -u=patch but without an explicit version
|
||||
# should patch-update it and its dependencies.
|
||||
cp go.mod.orig go.mod
|
||||
go get -u=patch patch.example.com/direct
|
||||
go get -d -u=patch patch.example.com/direct
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.0.1'
|
||||
stdout '^patch.example.com/indirect v1.0.1'
|
||||
@ -36,7 +37,7 @@ stdout '^patch.example.com/depofdirectpatch v1.0.0'
|
||||
|
||||
# Requesting only the indirect dependency should not update the direct one.
|
||||
cp go.mod.orig go.mod
|
||||
go get -u=patch patch.example.com/indirect
|
||||
go get -d -u=patch patch.example.com/indirect
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.0.0'
|
||||
stdout '^patch.example.com/indirect v1.0.1'
|
||||
@ -45,7 +46,7 @@ stdout '^patch.example.com/indirect v1.0.1'
|
||||
# @patch should apply only to the specific module,
|
||||
# but the result must reflect its upgraded requirements.
|
||||
cp go.mod.orig go.mod
|
||||
go get patch.example.com/direct@patch
|
||||
go get -d patch.example.com/direct@patch
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.0.1'
|
||||
stdout '^patch.example.com/indirect v1.0.0'
|
||||
@ -53,7 +54,7 @@ stdout '^patch.example.com/depofdirectpatch v1.0.0'
|
||||
|
||||
# An explicit @patch should override a general -u.
|
||||
cp go.mod.orig go.mod
|
||||
go get -u patch.example.com/direct@patch
|
||||
go get -d -u patch.example.com/direct@patch
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.0.1'
|
||||
stdout '^patch.example.com/indirect v1.1.0'
|
||||
@ -61,7 +62,7 @@ stdout '^patch.example.com/depofdirectpatch v1.0.0'
|
||||
|
||||
# An explicit @latest should override a general -u=patch.
|
||||
cp go.mod.orig go.mod
|
||||
go get -u=patch patch.example.com/direct@latest
|
||||
go get -d -u=patch patch.example.com/direct@latest
|
||||
go list -m all
|
||||
stdout '^patch.example.com/direct v1.1.0'
|
||||
stdout '^patch.example.com/indirect v1.0.1'
|
||||
@ -73,7 +74,7 @@ cp go.mod.orig go.mod
|
||||
stderr 'cannot use pattern .* with explicit version'
|
||||
|
||||
# However, standard-library packages without explicit versions are fine.
|
||||
go get -u=patch -d cmd/go
|
||||
go get -d -u=patch -d cmd/go
|
||||
|
||||
|
||||
-- go.mod --
|
||||
|
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# initial conditions: using sampler v1.3.0, not listed in go.mod.
|
||||
go list -deps
|
||||
|
1
src/cmd/go/testdata/script/mod_verify.txt
vendored
1
src/cmd/go/testdata/script/mod_verify.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# With good go.sum, verify succeeds by avoiding download.
|
||||
cp go.sum.good go.sum
|
||||
|
1
src/cmd/go/testdata/script/mod_why.txt
vendored
1
src/cmd/go/testdata/script/mod_why.txt
vendored
@ -1,4 +1,5 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
go list -test all
|
||||
stdout rsc.io/quote
|
||||
|
@ -1,4 +1,6 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# Check for correct naming of temporary executable
|
||||
|
||||
#Test for single file specified
|
||||
|
6
src/cmd/go/testdata/script/sum_readonly.txt
vendored
6
src/cmd/go/testdata/script/sum_readonly.txt
vendored
@ -1,17 +1,17 @@
|
||||
# Test that go.sum does not get updated when -mod=readonly flag is set
|
||||
env GO111MODULE=on
|
||||
|
||||
go get rsc.io/quote
|
||||
go get -d rsc.io/quote
|
||||
go mod tidy
|
||||
|
||||
# go.sum != dirty; -mod=readonly
|
||||
go build -mod=readonly
|
||||
go list -mod=readonly
|
||||
|
||||
# dirty up go.sum by removing it.
|
||||
rm go.sum
|
||||
|
||||
# go.sum == dirty; -mod=readonly
|
||||
! go build -mod=readonly
|
||||
! go list -mod=readonly
|
||||
|
||||
stderr 'go: updates to go.sum needed, disabled by -mod=readonly'
|
||||
|
||||
|
98
src/cmd/go/testdata/script/test_init.txt
vendored
98
src/cmd/go/testdata/script/test_init.txt
vendored
@ -4,61 +4,29 @@ env GO111MODULE=on
|
||||
|
||||
# A TestMain should be able to access testing flags if it calls flag.Parse
|
||||
# without needing to use testing.Init.
|
||||
go test testmain_flag_test.go
|
||||
|
||||
# Test code can use the name 'testing' without colliding with generated
|
||||
# testinginit code.
|
||||
go test testing_collision_test.go
|
||||
|
||||
# Tests running under 'go test' should observe that testing.Init is called
|
||||
# before any user package initialization code runs.
|
||||
go test ./testinitflag
|
||||
go test
|
||||
stdout TestMain
|
||||
stdout TestInit
|
||||
stdout TestExt
|
||||
|
||||
-- testmain_flag_test.go --
|
||||
package testmain_flag_test
|
||||
-- go.mod --
|
||||
module m
|
||||
|
||||
-- init_test.go --
|
||||
package testinitflag
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
Testing "testing"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
found := false
|
||||
flag.VisitAll(func(f *flag.Flag) {
|
||||
if f.Name == "test.count" {
|
||||
found = true
|
||||
}
|
||||
})
|
||||
if !found {
|
||||
fmt.Println("testing flags not registered")
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestX(t *testing.T) {}
|
||||
|
||||
-- testing_collision_test.go --
|
||||
package testing_collision_test
|
||||
|
||||
import testing2 "testing"
|
||||
|
||||
var testing = 3
|
||||
|
||||
func TestX(t *testing2.T) {}
|
||||
|
||||
-- go.mod --
|
||||
module m
|
||||
|
||||
-- testinitflag/init.go --
|
||||
package testinitflag
|
||||
|
||||
import "flag"
|
||||
|
||||
func TestFlagsInitialized() bool {
|
||||
func testFlagsInitialized() bool {
|
||||
found := false
|
||||
flag.VisitAll(func(f *flag.Flag) {
|
||||
if f.Name == "test.count" {
|
||||
@ -68,30 +36,50 @@ func TestFlagsInitialized() bool {
|
||||
return found
|
||||
}
|
||||
|
||||
-- testinitflag/init_test.go --
|
||||
package testinitflag
|
||||
var testing int
|
||||
var testingInitAtInitialization = testFlagsInitialized()
|
||||
|
||||
import "testing"
|
||||
|
||||
var testingInitAtInitialization = TestFlagsInitialized()
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
func TestInit(t *Testing.T) {
|
||||
if !testingInitAtInitialization {
|
||||
t.Fatal("testing.Init not called before package initialization")
|
||||
}
|
||||
fmt.Printf("TestInit\n")
|
||||
}
|
||||
|
||||
-- testinitflag/external_test.go --
|
||||
func TestMain(m *Testing.M) {
|
||||
fmt.Printf("TestMain\n")
|
||||
flag.Parse()
|
||||
if !testFlagsInitialized() {
|
||||
fmt.Println("testing flags not registered")
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
-- external_test.go --
|
||||
package testinitflag_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"m/testinitflag"
|
||||
"flag"
|
||||
"fmt"
|
||||
Testing "testing"
|
||||
)
|
||||
|
||||
var testingInitAtInitialization = testinitflag.TestFlagsInitialized()
|
||||
func testFlagsInitialized() bool {
|
||||
found := false
|
||||
flag.VisitAll(func(f *flag.Flag) {
|
||||
if f.Name == "test.count" {
|
||||
found = true
|
||||
}
|
||||
})
|
||||
return found
|
||||
}
|
||||
|
||||
func TestInitExternal(t *testing.T) {
|
||||
var testing int
|
||||
var testingInitAtInitialization = testFlagsInitialized()
|
||||
|
||||
func TestExt(t *Testing.T) {
|
||||
fmt.Printf("TestExt\n")
|
||||
if !testingInitAtInitialization {
|
||||
t.Fatal("testing.Init not called before package initialization")
|
||||
}
|
||||
|
1
src/cmd/go/testdata/script/test_timeout.txt
vendored
1
src/cmd/go/testdata/script/test_timeout.txt
vendored
@ -1,3 +1,4 @@
|
||||
[short] skip
|
||||
env GO111MODULE=off
|
||||
cd a
|
||||
|
||||
|
2
src/cmd/go/testdata/script/version.txt
vendored
2
src/cmd/go/testdata/script/version.txt
vendored
@ -1,4 +1,6 @@
|
||||
env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
go build -o fortune.exe rsc.io/fortune
|
||||
go version fortune.exe
|
||||
stdout '^fortune.exe: .+'
|
||||
|
3
src/cmd/go/testdata/script/vet_asm.txt
vendored
3
src/cmd/go/testdata/script/vet_asm.txt
vendored
@ -2,8 +2,7 @@ env GO111MODULE=off
|
||||
|
||||
# Issue 27665. Verify that "go vet" analyzes non-Go files.
|
||||
|
||||
env GOOS=linux
|
||||
env GOARCH=amd64
|
||||
[!amd64] skip
|
||||
! go vet -asmdecl a
|
||||
stderr 'f: invalid MOVW of x'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user