return nil, false
}
for i, t := range testInterceptors {
- if u.Host == t.FromHost && (t.Scheme == "" || u.Scheme == t.Scheme) {
+ if u.Host == t.FromHost && (u.Scheme == "" || u.Scheme == t.Scheme) {
return &testInterceptors[i], true
}
}
"GOROOT=" + testGOROOT,
"GOROOT_FINAL=" + testGOROOT_FINAL, // causes spurious rebuilds and breaks the "stale" built-in if not propagated
"GOTRACEBACK=system",
+ "TESTGONETWORK=panic", // allow only local connections by default; the [net] condition resets this
"TESTGO_GOROOT=" + testGOROOT,
"TESTGO_EXE=" + testGo,
"TESTGO_VCSTEST_HOST=" + httpURL.Host,
"GIT_TRACE_CURL_NO_DATA=1",
"GIT_REDACT_COOKIES=o,SSO,GSSO_Uberproxy")
}
- if !testenv.HasExternalNetwork() {
- env = append(env, "TESTGONETWORK=panic", "TESTGOVCS=panic")
+ if testing.Short() {
+ // VCS commands are always somewhat slow: they either require access to external hosts,
+ // or they require our intercepted vcs-test.golang.org to regenerate the repository.
+ // Require all tests that use VCS commands to be skipped in short mode.
+ env = append(env, "TESTGOVCS=panic")
}
if os.Getenv("CGO_ENABLED") != "" || runtime.GOOS != goHostOS || runtime.GOARCH != goHostArch {
// If the actual CGO_ENABLED might not match the cmd/go default, set it
add("buildmode", script.PrefixCondition("go supports -buildmode=<suffix>", hasBuildmode))
add("case-sensitive", script.OnceCondition("$WORK filesystem is case-sensitive", isCaseSensitive))
add("cgo", script.BoolCondition("host CGO_ENABLED", testenv.HasCGO()))
+ add("cgolinkext", script.BoolCondition("platform requires external linking for cgo", platform.MustLinkExternal(cfg.Goos, cfg.Goarch, true)))
add("cross", script.BoolCondition("cmd/go GOOS/GOARCH != GOHOSTOS/GOHOSTARCH", goHostOS != runtime.GOOS || goHostArch != runtime.GOARCH))
add("fuzz", sysCondition("-fuzz", platform.FuzzSupported, false))
add("fuzz-instrumented", sysCondition("-fuzz with instrumentation", platform.FuzzInstrumented, false))
add("link", lazyBool("testenv.HasLink()", testenv.HasLink))
add("mismatched-goroot", script.Condition("test's GOROOT_FINAL does not match the real GOROOT", isMismatchedGoroot))
add("msan", sysCondition("-msan", platform.MSanSupported, true))
- add("cgolinkext", script.BoolCondition("platform requires external linking for cgo", platform.MustLinkExternal(cfg.Goos, cfg.Goarch, true)))
- add("net", lazyBool("testenv.HasExternalNetwork()", testenv.HasExternalNetwork))
+ add("net", script.PrefixCondition("can connect to external network host <suffix>", hasNet))
add("race", sysCondition("-race", platform.RaceDetectorSupported, true))
add("symlink", lazyBool("testenv.HasSymlink()", testenv.HasSymlink))
add("trimpath", script.OnceCondition("test binary was built with -trimpath", isTrimpath))
return platform.BuildModeSupported(runtime.Compiler, mode, GOOS, GOARCH), nil
}
+func hasNet(s *script.State, host string) (bool, error) {
+ if !testenv.HasExternalNetwork() {
+ return false, nil
+ }
+
+ // TODO(bcmills): Add a flag or environment variable to allow skipping tests
+ // for specific hosts and/or skipping all net tests except for specific hosts.
+
+ // Since we have confirmed that the network is available,
+ // allow cmd/go to use it.
+ s.Setenv("TESTGONETWORK", "")
+ return true, nil
+}
+
func hasGodebug(s *script.State, value string) (bool, error) {
godebug, _ := s.LookupEnv("GODEBUG")
for _, p := range strings.Split(godebug, ",") {
test's GOROOT_FINAL does not match the real GOROOT
[msan]
GOOS/GOARCH supports -msan
-[net]
- testenv.HasExternalNetwork()
+[net:*]
+ can connect to external network host <suffix>
[race]
GOOS/GOARCH supports -race
[root]
# golang.org/issue/13037: 'go get' was not parsing <meta> tags in 404 served over HTTPS.
-[!net] skip
+[!net:bazil.org] skip
[!git] skip
env GONOSUMDB=bazil.org,github.com,golang.org
-[!net] skip
+[!net:rsc.io] skip
[!git] skip
env GO111MODULE=off
# Tests issue 8181
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
# Tests issue #9357
# go get foo.io (not foo.io/subdir) was not working consistently.
-[!net] skip
+[!net:go-get-issue-9357.appspot.com] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:rsc.io] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:github.com] skip
env GO111MODULE=off
# Issue 4186. go get cannot be used to download packages to $GOROOT.
# TODO(matloob): Split this test into two? It's one of the slowest tests we have.
-[!net] skip
+[!net:insecure.go-get-issue-15410.appspot.com] skip
[!git] skip
env PATH=$WORK/tmp/bin${:}$PATH
-[!net] skip
+[!net:insecure.go-get-issue-15410.appspot.com] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:insecure.go-get-issue-15410.appspot.com] skip
[!git] skip
# GOPATH: Set up
# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure (now replaced by GOINSECURE).
# golang.org/issue/34049: 'go get' would panic in case of an insecure redirect in GOPATH mode
-[!net] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
# go get -u was not working except in checkout directory
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:rsc.io] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
# This test verifies a fix for a security issue; see https://go.dev/issue/22125.
-[!net] skip
+[short] skip
[!git] skip
[!exec:svn] skip
-[!net] skip
+[!net:golang.org] skip
[!git] skip
env GOBIN=$WORK/tmp/gobin
stderr 'golang.org/x/tools: no Go files'
! go get -d golang.org/x/tools
-stderr 'golang.org/x/tools: no Go files'
\ No newline at end of file
+stderr 'golang.org/x/tools: no Go files'
# Tests issue #20502
-[!net] skip
+[!net:github.com] skip
[!git] skip
[!race] skip
env GO111MODULE=off
-[!net] skip
+[!net:golang.org] skip
[!git] skip
env GO111MODULE=off
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
+! go get vcs-test.golang.org/longna~1.dir/thing
stderr 'trailing tilde and digits'
-! go get example.com/longna~1/thing
+! go get vcs-test.golang.org/longna~1/thing
stderr 'trailing tilde and digits'
-! go get example.com/~9999999/thing
+! go get vcs-test.golang.org/~9999999/thing
stderr 'trailing tilde and digits'
+[short] stop
+
# A path containing an element that is just a tilde, or a tilde followed by non-digits,
# should attempt to resolve.
-! go get example.com/~glenda/notfound
+! go get vcs-test.golang.org/~glenda/notfound
! stderr 'trailing tilde and digits'
stderr 'unrecognized import path'
-! go get example.com/~glenda2/notfound
+! go get vcs-test.golang.org/~glenda2/notfound
! stderr 'trailing tilde and digits'
stderr 'unrecognized import path'
-! go get example.com/~/notfound
+! go get vcs-test.golang.org/~/notfound
! stderr 'trailing tilde and digits'
stderr 'unrecognized import path'
# The recursive updating was trying to walk to
# former dependencies, not current ones.
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
# Issue 14444: go get -u .../ duplicate loads errors
# Check that go get update -u ... does not try to load duplicates
-[!net] skip
-
env GO111MODULE=off
go get -u -n .../
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
# Issue 14450: go get -u .../ tried to import not downloaded package
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
go get -d
go get -t -d
-[!net] stop
+[!net:github.com] stop
[!git] stop
cd $GOPATH/src
env GIT_TRACE=1
-[!net] skip
+[!net:golang.org] skip
[!git] skip
# go get should be success when GIT_TRACE set
# Test that 'go get -u' reports packages whose VCS configurations do not
# match their import paths.
-[!net] skip
+[!net:rsc.io] skip
[short] skip
# We need to execute a custom Go program to break the config files.
-[!net] skip
env GO111MODULE=off
# Issue 17119: Test more duplicate load errors.
# git is OK by default
env GOVCS=
env GONOSUMDB='*'
-[net] [git] [!short] go get rsc.io/sampler
+[net:rsc.io] [git] [!short] go get rsc.io/sampler
# hg is OK by default
env GOVCS=
env GONOSUMDB='*'
-[net] [exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello
+[exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello
# git can be disallowed
env GOVCS=public:hg
# git is OK by default
env GOVCS=
env GONOSUMDB='*'
-[net] [git] [!short] go get rsc.io/sampler
+[net:rsc.io] [git] [!short] go get rsc.io/sampler
# hg is OK by default
env GOVCS=
env GONOSUMDB='*'
-[net] [exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello
+[exec:hg] [!short] go get vcs-test.golang.org/go/custom-hg-hello
# git can be disallowed
env GOVCS=public:hg
# Tests Issue #3562
# go get foo.io (not foo.io/subdir) was not working consistently.
-[!net] skip
-
env GO111MODULE=off
env GOPATH=$WORK/gopath1${:}$WORK/gopath2
# However, 'go mod' and 'go get' subcommands should report the original module
# dependencies, not the vendored packages.
-[!net] stop
+[!net:golang.org] stop
env GOPROXY=
env GOWORK=off
-[!net] skip
+[short] skip
env GO111MODULE=on
env GOPROXY=direct
-[short] skip
-[!net] skip
+[!net:github.com] skip
+[!net:golang.org] skip
+[!net:gopkg.in] skip
[!git] skip
env GO111MODULE=on
go mod init github.com/docker/distribution
cmpenv go.mod go.mod.want
+[!net:google.golang.org] skip
+[!net:cloud.google.com] skip
+
go mod download github.com/fishy/gcsbucket@v0.0.0-20180217031846-618d60fe84e0
cp $GOPATH/pkg/mod/github.com/fishy/gcsbucket@v0.0.0-20180217031846-618d60fe84e0/Gopkg.lock ../y
cd ../y
env GOPROXY=direct
env GOSUMDB=off
-[!net] skip
+[short] skip
[!git] skip
# secure fetch should report insecure warning
env GO111MODULE=on
-[!net] skip
+[short] skip
[!git] skip
env GOPROXY=direct
-- $WORK/home/gopher/.gitconfig --
[log]
- decorate = full
\ No newline at end of file
+ decorate = full
env GO111MODULE=on
# Testing mod download with non semantic versions; turn off proxy.
-[!net] skip
+[!net:rsc.io] skip
[!git] skip
env GOPROXY=direct
env GOSUMDB=off
# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure (now replaced by GOINSECURE).
-[!net] skip
+[short] skip
[!git] skip
env GO111MODULE=on
-[short] skip
+[!net:github.com] skip
[!git] skip
-[!net] skip
[!GOOS:linux] skip # Uses XDG_CONFIG_HOME
env GIT_CONFIG_GLOBAL=$WORK/.gitconfig
env GO111MODULE=on
# Testing stderr for git ls-remote; turn off proxy.
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GOPROXY=direct
-[!net] skip
+[short] skip
[!exec:svn] skip
# 'go mod download' will fall back to svn+ssh once svn fails over protocols like https.
# 'GOPROXY=direct go get golang.org/x/tools/gopls@master' did not correctly
# resolve the pseudo-version for its dependency on golang.org/x/tools.
-[short] skip
-[!net] skip
+[!net:cloud.google.com] skip
[!git] skip
env GO111MODULE=on
env GO111MODULE=on
-[!net] skip
+[!net:golang.org] skip
+[!net:proxy.golang.org] skip
env GOPROXY=https://proxy.golang.org,direct
env GOSUMDB=off
-[!net] skip
+[short] skip
[!exec:fossil] skip
# Regression test for 'go get' to ensure repositories
env GO111MODULE=on
env GOPROXY=direct
env GOSUMDB=off
-[!net] skip
+[!net:golang.org] skip
[!git] skip
# fetch commit hash reachable from refs/heads/* and refs/tags/* is OK
-[!net] skip
+[short] skip
[!git] skip
env GO111MODULE=on
env GO111MODULE=on
# Testing git->module converter's generation of +incompatible tags; turn off proxy.
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GOPROXY=direct
env GOSUMDB=off
# tag that appears in any commit that is a (transitive) parent of the commit
# supplied to 'go get', regardless of branches
-[!net] skip
+[short] skip
[!git] skip
# For this test repository:
# prefixed tag in any commit that is a parent of the commit supplied
# to 'go get', when using a repo with go.mod in a sub directory.
-[!net] skip
+[short] skip
[!git] skip
# For this test repository go.mod resides in sub/ (only):
-[short] skip
-[!net] skip
+[!net:golang.org] skip
[!git] skip
env GO111MODULE=on
env GOPROXY=direct
# Testing that git export-subst is disabled
-[!net] skip
+[!net:github.com] skip
[!git] skip
go build
stderr '^go: golang.org/x/text: module lookup disabled by GOPROXY=off$'
# GONOPROXY bypasses proxy
-[!net] skip
+[!net:rsc.io] skip
[!git] skip
env GOPRIVATE=none
env GONOPROXY='*/fortune'
! go get rsc.io/fortune # does not exist in real world, only on test proxy
stderr 'git ls-remote'
+[!net:golang.org] skip
env GOSUMDB=
env GONOPROXY=
env GOPRIVATE='*/x'
cp go.mod.empty go.mod
go list
-[!net] skip
+[!net:gopkg.in] skip
[!git] skip
skip # TODO(#54503): redirect gopkg.in requests to a local server and re-enable.
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=on
-[!net] skip
+[!net:golang.org] skip
[!git] skip
env GO111MODULE=on
! go list -m golang.org/x/text
stderr 'golang.org/x/text@v0.1.1-0.20170915032832-14c0d48ead0c\+incompatible: invalid version: \+incompatible suffix not allowed: major version v0 is compatible'
+[!net:github.com] stop
+
# The pseudo-version for a commit after a tag with a non-matching major version
# should instead be based on the last matching tag.
cp go.mod.orig go.mod
env GOPROXY=direct
env GOSUMDB=off
-[!net] skip
+[short] skip
[!git] skip
# golang.org/issue/33099: if an import path ends in a major-version suffix,
[short] skip
[!git] skip
-[!net] skip
env GOPROXY=direct
# subgroups could not be fetched because the server returned bogus go-import
# tags for prefixes of the module path.
-[!net] skip
+[short] skip
[!git] skip
env GO111MODULE=on
# @latest, @upgrade, and @patch should prefer compatible versions over
# +incompatible ones, even if offered by a proxy.
-[!net] skip
+[!net:github.com] skip
+[!net:proxy.golang.org] skip
env GO111MODULE=on
env GOPROXY=
-[!net] skip
+[short] skip
env GO111MODULE=on
env GOSUMDB=off
! go list -versions -m golang.org/x/text
stderr 'invalid proxy URL.*proxydir'
-[!net] stop
+[!net:proxy.golang.org] stop
# GOPROXY HTTPS paths may elide the "https://" prefix.
# (See golang.org/issue/32191.)
-[!net] skip
+[!net:golang.org] skip
[!git] skip
env GO111MODULE=on
skip 'skipping test that depends on an unreliable third-party server; see https://go.dev/issue/54503'
# TODO(#54043): Make this test hermetic and re-enable it.
-[short] skip
-[!net] skip
+[!net:gopkg.in] skip
[!git] skip
env GO111MODULE=on
# as the base.
# Verifies golang.org/issue/41700.
-[!net] skip
+[short] skip
[!git] skip
env GOPROXY=direct
env GOSUMDB=off
-[!net] skip
+[!net:proxy.golang.org] skip
env GO111MODULE=on
env GOSUMDB=
# Download direct from github.
-[!net] skip
+[!net:proxy.golang.org] skip
+[!net:sum.golang.org] skip
[!git] skip
env GOSUMDB=sum.golang.org
env GOPROXY=direct
[exec:bzr] skip 'tests NOT having bzr'
-[!net] skip
+[!net:launchpad.net] skip
env GO111MODULE=on
env GOPROXY=direct
[short] skip
[!git] skip
-[!net] skip
env GO111MODULE=on
env GOPROXY=direct
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off
-[!net] skip
+[!net:github.com] skip
[!git] skip
env GO111MODULE=off