mirror of
https://github.com/golang/go
synced 2024-11-23 03:40:02 -07:00
cmd/go/internal/script: define GOOS, GOARCH, and compiler conditions using suffixes
This replaces a large set of individual GOOS and GOARCH conditions with a smaller set of more verbose conditions. On balance, the more uniform structure and more concise documentation seem worth the verbosity. For #27494. Change-Id: I73fdf9e7180a92cb1baf5d4631aeecb26ce15181 Reviewed-on: https://go-review.googlesource.com/c/go/+/420054 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
4319231686
commit
3f84a3f324
@ -6,6 +6,7 @@ package script
|
||||
|
||||
import (
|
||||
"cmd/go/internal/imports"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
@ -18,18 +19,43 @@ import (
|
||||
func DefaultConds() map[string]Cond {
|
||||
conds := make(map[string]Cond)
|
||||
|
||||
// TODO(bcmills): switch these conditions to use suffixes, like '[GOOS:windows]'
|
||||
// instead of just '[windows]'.
|
||||
conds["GOOS"] = PrefixCondition(
|
||||
"runtime.GOOS == <suffix>",
|
||||
func(_ *State, suffix string) (bool, error) {
|
||||
if suffix == runtime.GOOS {
|
||||
return true, nil
|
||||
}
|
||||
if _, ok := imports.KnownOS[suffix]; !ok {
|
||||
return false, fmt.Errorf("unrecognized GOOS %q", suffix)
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
|
||||
for os := range imports.KnownOS {
|
||||
conds[os] = BoolCondition("host GOOS="+os, false)
|
||||
}
|
||||
conds[runtime.GOOS] = BoolCondition("host GOOS="+runtime.GOOS, true)
|
||||
conds["GOARCH"] = PrefixCondition(
|
||||
"runtime.GOARCH == <suffix>",
|
||||
func(_ *State, suffix string) (bool, error) {
|
||||
if suffix == runtime.GOARCH {
|
||||
return true, nil
|
||||
}
|
||||
if _, ok := imports.KnownArch[suffix]; !ok {
|
||||
return false, fmt.Errorf("unrecognized GOOS %q", suffix)
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
|
||||
for arch := range imports.KnownArch {
|
||||
conds[arch] = BoolCondition("host GOARCH="+arch, false)
|
||||
}
|
||||
conds[runtime.GOARCH] = BoolCondition("host GOARCH="+runtime.GOARCH, true)
|
||||
conds["compiler"] = PrefixCondition(
|
||||
"runtime.Compiler == <suffix>",
|
||||
func(_ *State, suffix string) (bool, error) {
|
||||
if suffix == runtime.Compiler {
|
||||
return true, nil
|
||||
}
|
||||
switch suffix {
|
||||
case "gc", "gccgo":
|
||||
return false, nil
|
||||
default:
|
||||
return false, fmt.Errorf("unrecognized compiler %q", suffix)
|
||||
}
|
||||
})
|
||||
|
||||
conds["root"] = BoolCondition("os.Geteuid() == 0", os.Geteuid() == 0)
|
||||
|
||||
|
@ -41,8 +41,6 @@ func scriptConditions() map[string]script.Cond {
|
||||
add("cross", script.BoolCondition("cmd/go GOOS/GOARCH != GOHOSTOS/GOHOSTARCH", goHostOS != runtime.GOOS || goHostArch != runtime.GOARCH))
|
||||
add("fuzz", sysCondition("-fuzz", platform.FuzzSupported))
|
||||
add("fuzz-instrumented", sysCondition("-fuzz with instrumentation", platform.FuzzInstrumented))
|
||||
add("gc", script.BoolCondition(`runtime.Compiler == "gc"`, runtime.Compiler == "gc"))
|
||||
add("gccgo", script.BoolCondition(`runtime.Compiler == "gccgo"`, runtime.Compiler == "gccgo"))
|
||||
add("git", lazyBool("the 'git' executable exists and provides the standard CLI", hasWorkingGit))
|
||||
add("GODEBUG", script.PrefixCondition("GODEBUG contains <suffix>", hasGodebug))
|
||||
add("GOEXPERIMENT", script.PrefixCondition("GOEXPERIMENT <suffix> is enabled", hasGoexperiment))
|
||||
|
92
src/cmd/go/testdata/script/README
vendored
92
src/cmd/go/testdata/script/README
vendored
@ -362,28 +362,14 @@ wait
|
||||
|
||||
|
||||
The available conditions are:
|
||||
[386]
|
||||
host GOARCH=386
|
||||
[GOARCH:*]
|
||||
runtime.GOARCH == <suffix>
|
||||
[GODEBUG:*]
|
||||
GODEBUG contains <suffix>
|
||||
[GOEXPERIMENT:*]
|
||||
GOEXPERIMENT <suffix> is enabled
|
||||
[aix]
|
||||
host GOOS=aix
|
||||
[amd64]
|
||||
host GOARCH=amd64
|
||||
[amd64p32]
|
||||
host GOARCH=amd64p32
|
||||
[android]
|
||||
host GOOS=android
|
||||
[arm]
|
||||
host GOARCH=arm
|
||||
[arm64]
|
||||
host GOARCH=arm64
|
||||
[arm64be]
|
||||
host GOARCH=arm64be
|
||||
[armbe]
|
||||
host GOARCH=armbe
|
||||
[GOOS:*]
|
||||
runtime.GOOS == <suffix>
|
||||
[asan]
|
||||
GOOS/GOARCH supports -asan
|
||||
[buildmode:*]
|
||||
@ -392,102 +378,36 @@ The available conditions are:
|
||||
$WORK filesystem is case-sensitive
|
||||
[cgo]
|
||||
host CGO_ENABLED
|
||||
[compiler:*]
|
||||
runtime.Compiler == <suffix>
|
||||
[cross]
|
||||
cmd/go GOOS/GOARCH != GOHOSTOS/GOHOSTARCH
|
||||
[darwin]
|
||||
host GOOS=darwin
|
||||
[dragonfly]
|
||||
host GOOS=dragonfly
|
||||
[exec:*]
|
||||
<suffix> names an executable in the test binary's PATH
|
||||
[freebsd]
|
||||
host GOOS=freebsd
|
||||
[fuzz]
|
||||
GOOS/GOARCH supports -fuzz
|
||||
[fuzz-instrumented]
|
||||
GOOS/GOARCH supports -fuzz with instrumentation
|
||||
[gc]
|
||||
runtime.Compiler == "gc"
|
||||
[gccgo]
|
||||
runtime.Compiler == "gccgo"
|
||||
[git]
|
||||
the 'git' executable exists and provides the standard CLI
|
||||
[hurd]
|
||||
host GOOS=hurd
|
||||
[illumos]
|
||||
host GOOS=illumos
|
||||
[ios]
|
||||
host GOOS=ios
|
||||
[js]
|
||||
host GOOS=js
|
||||
[link]
|
||||
testenv.HasLink()
|
||||
[linux]
|
||||
host GOOS=linux
|
||||
[loong64]
|
||||
host GOARCH=loong64
|
||||
[mips]
|
||||
host GOARCH=mips
|
||||
[mips64]
|
||||
host GOARCH=mips64
|
||||
[mips64le]
|
||||
host GOARCH=mips64le
|
||||
[mips64p32]
|
||||
host GOARCH=mips64p32
|
||||
[mips64p32le]
|
||||
host GOARCH=mips64p32le
|
||||
[mipsle]
|
||||
host GOARCH=mipsle
|
||||
[mismatched-goroot]
|
||||
test's GOROOT_FINAL does not match the real GOROOT
|
||||
[msan]
|
||||
GOOS/GOARCH supports -msan
|
||||
[nacl]
|
||||
host GOOS=nacl
|
||||
[net]
|
||||
testenv.HasExternalNetwork()
|
||||
[netbsd]
|
||||
host GOOS=netbsd
|
||||
[openbsd]
|
||||
host GOOS=openbsd
|
||||
[plan9]
|
||||
host GOOS=plan9
|
||||
[ppc]
|
||||
host GOARCH=ppc
|
||||
[ppc64]
|
||||
host GOARCH=ppc64
|
||||
[ppc64le]
|
||||
host GOARCH=ppc64le
|
||||
[race]
|
||||
GOOS/GOARCH supports -race
|
||||
[riscv]
|
||||
host GOARCH=riscv
|
||||
[riscv64]
|
||||
host GOARCH=riscv64
|
||||
[root]
|
||||
os.Geteuid() == 0
|
||||
[s390]
|
||||
host GOARCH=s390
|
||||
[s390x]
|
||||
host GOARCH=s390x
|
||||
[short]
|
||||
testing.Short()
|
||||
[solaris]
|
||||
host GOOS=solaris
|
||||
[sparc]
|
||||
host GOARCH=sparc
|
||||
[sparc64]
|
||||
host GOARCH=sparc64
|
||||
[symlink]
|
||||
testenv.HasSymlink()
|
||||
[trimpath]
|
||||
test binary was built with -trimpath
|
||||
[verbose]
|
||||
testing.Verbose()
|
||||
[wasm]
|
||||
host GOARCH=wasm
|
||||
[windows]
|
||||
host GOOS=windows
|
||||
[zos]
|
||||
host GOOS=zos
|
||||
|
||||
|
2
src/cmd/go/testdata/script/bug.txt
vendored
2
src/cmd/go/testdata/script/bug.txt
vendored
@ -1,6 +1,6 @@
|
||||
# Verify that go bug creates the appropriate URL issue body
|
||||
|
||||
[!linux] skip
|
||||
[!GOOS:linux] skip
|
||||
[short] skip
|
||||
|
||||
go install
|
||||
|
@ -1,10 +1,10 @@
|
||||
# Set GOCACHE to a clean directory to ensure that 'go build' has work to report.
|
||||
[!windows] env GOCACHE=$WORK/gocache
|
||||
[windows] env GOCACHE=$WORK\gocache
|
||||
[!GOOS:windows] env GOCACHE=$WORK/gocache
|
||||
[GOOS:windows] env GOCACHE=$WORK\gocache
|
||||
|
||||
# 'go build' should use GOTMPDIR if set.
|
||||
[!windows] env GOTMPDIR=$WORK/my-favorite-tmpdir
|
||||
[windows] env GOTMPDIR=$WORK\my-favorite-tmpdir
|
||||
[!GOOS:windows] env GOTMPDIR=$WORK/my-favorite-tmpdir
|
||||
[GOOS:windows] env GOTMPDIR=$WORK\my-favorite-tmpdir
|
||||
mkdir $GOTMPDIR
|
||||
go build -x hello.go
|
||||
stderr ^WORK=.*my-favorite-tmpdir
|
||||
|
@ -1,4 +1,4 @@
|
||||
[!windows] stop
|
||||
[!GOOS:windows] stop
|
||||
[!exec:icacls] skip
|
||||
[!exec:powershell] skip
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
env GO111MODULE=off
|
||||
env GODEBUG=gocachetest=1
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
[short] skip # clears cache, rebuilds too much
|
||||
|
||||
# Set up fresh GOCACHE.
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gccgo] skip 'gccgo does not support -ldflags -X'
|
||||
[compiler:gccgo] skip 'gccgo does not support -ldflags -X'
|
||||
env GO111MODULE=off
|
||||
go build run_go.go
|
||||
|
||||
@ -8,7 +8,7 @@ exec $WORK/tmp/a.exe
|
||||
stderr 'linkXworked'
|
||||
rm $WORK/tmp/a.exe
|
||||
|
||||
[!windows] stop 'rest of the tests only apply to Windows'
|
||||
[!GOOS:windows] stop 'rest of the tests only apply to Windows'
|
||||
|
||||
# Replace '\' with '/' in GOPATH
|
||||
exec ./run_go$GOEXE $GOPATH/src/my.pkg/main $GOPATH REPLACE_SLASH build -o $WORK/tmp/a.exe -ldflags -X=my.pkg.Text=linkXworked
|
||||
|
@ -1,8 +1,8 @@
|
||||
[short] skip
|
||||
[!cgo] skip
|
||||
|
||||
[solaris] skip "skipping on Solaris; see golang.org/issue/13247"
|
||||
[illumos] skip "skipping on Solaris; see golang.org/issue/13247"
|
||||
[GOOS:solaris] skip "skipping on Solaris; see golang.org/issue/13247"
|
||||
[GOOS:illumos] skip "skipping on Solaris; see golang.org/issue/13247"
|
||||
|
||||
go build -o $WORK/exe1$GOEXE cgotest
|
||||
go build -x -o $WORK/exe2$GOEXE cgotest
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Test that we pass -arch flag to C compiler on Darwin (issue 43692).
|
||||
|
||||
[!darwin] skip
|
||||
[!GOOS:darwin] skip
|
||||
[!cgo] skip
|
||||
|
||||
# clear CC, in case user sets it
|
||||
|
4
src/cmd/go/testdata/script/build_gcflags.txt
vendored
4
src/cmd/go/testdata/script/build_gcflags.txt
vendored
@ -2,9 +2,9 @@ env GO111MODULE=off
|
||||
|
||||
# Test that the user can override default code generation flags.
|
||||
|
||||
[gccgo] skip # gccgo does not use -gcflags
|
||||
[compiler:gccgo] skip # gccgo does not use -gcflags
|
||||
[!cgo] skip
|
||||
[!linux] skip # test only works if c-archive implies -shared
|
||||
[!GOOS:linux] skip # test only works if c-archive implies -shared
|
||||
[short] skip
|
||||
|
||||
env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
|
||||
|
@ -15,7 +15,7 @@ env GO111MODULE=off
|
||||
stderr 'p\.go:3:8: use of internal package .*internal/w not allowed'
|
||||
env GO111MODULE=''
|
||||
|
||||
[gccgo] skip # gccgo does not have GOROOT
|
||||
[compiler:gccgo] skip # gccgo does not have GOROOT
|
||||
cd ../testinternal
|
||||
! go build -v .
|
||||
stderr 'p\.go:3:8: use of internal package net/http/internal not allowed'
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
[short] skip
|
||||
[!cgo] skip
|
||||
[windows] skip # The Go Windows builders have an extremely out-of-date gcc that does not support reproducible builds; see https://go.dev/issue/50824.
|
||||
[GOOS:windows] skip # The Go Windows builders have an extremely out-of-date gcc that does not support reproducible builds; see https://go.dev/issue/50824.
|
||||
|
||||
# This test is sensitive to cache invalidation,
|
||||
# so use a separate build cache that we can control.
|
||||
|
@ -3,7 +3,7 @@
|
||||
# "go test -c" should also appear to write a new binary every time,
|
||||
# even if it's really just updating the mtime on an existing up-to-date binary.
|
||||
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
[short] skip
|
||||
|
||||
# Install some commands to compare mtimes
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gccgo] skip 'gccgo does not support -ldflags -X'
|
||||
[compiler:gccgo] skip 'gccgo does not support -ldflags -X'
|
||||
|
||||
go build -o linkx$GOEXE -ldflags -X=my.pkg.Text=linkXworked my.pkg/main
|
||||
exec ./linkx$GOEXE
|
||||
|
10
src/cmd/go/testdata/script/build_nocache.txt
vendored
10
src/cmd/go/testdata/script/build_nocache.txt
vendored
@ -7,8 +7,8 @@ env GO111MODULE=off
|
||||
env GOCACHE=
|
||||
env XDG_CACHE_HOME=
|
||||
env HOME=
|
||||
[plan9] env home=
|
||||
[windows] env LocalAppData=
|
||||
[GOOS:plan9] env home=
|
||||
[GOOS:windows] env LocalAppData=
|
||||
! go build -o triv triv.go
|
||||
stderr 'build cache is required, but could not be located: GOCACHE is not defined and .*'
|
||||
|
||||
@ -23,13 +23,13 @@ env GOCACHE=off
|
||||
stderr 'build cache is disabled by GOCACHE=off'
|
||||
|
||||
# If GOCACHE is set to an unwritable directory, we should diagnose it as such.
|
||||
[windows] stop # Does not support unwritable directories.
|
||||
[GOOS:windows] stop # Does not support unwritable directories.
|
||||
[root] skip # Can write to unwritable directories.
|
||||
|
||||
mkdir $WORK/unwritable/home
|
||||
chmod 0555 $WORK/unwritable/home
|
||||
[!plan9] env HOME=$WORK/unwritable/home
|
||||
[plan9] env home=$WORK/unwritable/home
|
||||
[!GOOS:plan9] env HOME=$WORK/unwritable/home
|
||||
[GOOS:plan9] env home=$WORK/unwritable/home
|
||||
|
||||
env GOCACHE=$WORK/unwritable/home
|
||||
! go build -o triv triv.go
|
||||
|
22
src/cmd/go/testdata/script/build_output.txt
vendored
22
src/cmd/go/testdata/script/build_output.txt
vendored
@ -1,8 +1,8 @@
|
||||
[gccgo] skip 'gccgo has no standard packages'
|
||||
[compiler:gccgo] skip 'gccgo has no standard packages'
|
||||
[short] skip
|
||||
|
||||
[!windows] env NONEXE='.exe'
|
||||
[windows] env NONEXE=''
|
||||
[!GOOS:windows] env NONEXE='.exe'
|
||||
[GOOS:windows] env NONEXE=''
|
||||
|
||||
env GOBIN=$WORK/tmp/bin
|
||||
go install m/isarchive &
|
||||
@ -28,15 +28,15 @@ go build -o bin/ x.go
|
||||
exists -exec bin/x$GOEXE
|
||||
rm bin
|
||||
|
||||
[windows] ! exists bin
|
||||
[windows] go build -o bin\x x.go
|
||||
[windows] exists -exec bin\x
|
||||
[windows] rm bin
|
||||
[GOOS:windows] ! exists bin
|
||||
[GOOS:windows] go build -o bin\x x.go
|
||||
[GOOS:windows] exists -exec bin\x
|
||||
[GOOS:windows] rm bin
|
||||
|
||||
[windows] ! exists bin
|
||||
[windows] go build -o bin\ x.go
|
||||
[windows] exists -exec bin\x.exe
|
||||
[windows] rm bin
|
||||
[GOOS:windows] ! exists bin
|
||||
[GOOS:windows] go build -o bin\ x.go
|
||||
[GOOS:windows] exists -exec bin\x.exe
|
||||
[GOOS:windows] rm bin
|
||||
|
||||
! exists bin
|
||||
mkdir bin
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gccgo] skip 'gccgo has no standard packages'
|
||||
[compiler:gccgo] skip 'gccgo has no standard packages'
|
||||
go build -tags 'tag1 tag2' math
|
||||
! go build -tags 'tag1,tag2 tag3' math
|
||||
stderr 'space-separated list contains comma'
|
@ -14,7 +14,7 @@ go run ./list-dwarf hello.exe
|
||||
stdout gopath[/\\]src
|
||||
|
||||
# Check that the source path does not appear when -trimpath is used.
|
||||
[aix] stop # can't inspect XCOFF binaries
|
||||
[GOOS:aix] stop # can't inspect XCOFF binaries
|
||||
go build -trimpath -o hello.exe .
|
||||
! grep -q gopath[/\\]src hello.exe
|
||||
go run ./list-dwarf hello.exe
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gccgo] skip # gccgo assumes cross-compilation is always possible
|
||||
[compiler:gccgo] skip # gccgo assumes cross-compilation is always possible
|
||||
|
||||
env GOOS=windwos
|
||||
|
||||
|
6
src/cmd/go/testdata/script/cache_unix.txt
vendored
6
src/cmd/go/testdata/script/cache_unix.txt
vendored
@ -2,9 +2,9 @@ env GO111MODULE=off
|
||||
|
||||
# Integration test for cache directory calculation (cmd/go/internal/cache).
|
||||
|
||||
[windows] skip
|
||||
[darwin] skip
|
||||
[plan9] skip
|
||||
[GOOS:windows] skip
|
||||
[GOOS:darwin] skip
|
||||
[GOOS:plan9] skip
|
||||
|
||||
mkdir $WORK/gocache
|
||||
mkdir $WORK/xdg
|
||||
|
2
src/cmd/go/testdata/script/cache_vet.txt
vendored
2
src/cmd/go/testdata/script/cache_vet.txt
vendored
@ -2,7 +2,7 @@ env GO111MODULE=off
|
||||
|
||||
[short] skip
|
||||
[GODEBUG:gocacheverify=1] skip
|
||||
[gccgo] skip # gccgo has no standard packages
|
||||
[compiler:gccgo] skip # gccgo has no standard packages
|
||||
|
||||
# Start with a clean build cache:
|
||||
# test failures may be masked if the cache has just the right entries already.
|
||||
|
@ -4,9 +4,9 @@
|
||||
cp x.go.txt x.go
|
||||
|
||||
# Only allow //go:cgo_ldflag .* in cgo-generated code
|
||||
[gc] cp x_gc.go.txt x.go
|
||||
[gc] ! go build x
|
||||
[gc] stderr '//go:cgo_ldflag .* only allowed in cgo-generated code'
|
||||
[compiler:gc] cp x_gc.go.txt x.go
|
||||
[compiler:gc] ! go build x
|
||||
[compiler:gc] stderr '//go:cgo_ldflag .* only allowed in cgo-generated code'
|
||||
|
||||
# Ignore _* files
|
||||
rm x.go
|
||||
@ -16,11 +16,11 @@ cp cgo_yy.go.txt _cgo_yy.go
|
||||
! go build .
|
||||
stderr 'no Go files' #_* files are ignored...
|
||||
|
||||
[gc] ! go build _cgo_yy.go # ... but if forced, the comment is rejected
|
||||
[compiler:gc] ! go build _cgo_yy.go # ... but if forced, the comment is rejected
|
||||
# Actually, today there is a separate issue that _ files named
|
||||
# on the command line are ignored. Once that is fixed,
|
||||
# we want to see the cgo_ldflag error.
|
||||
[gc] stderr '//go:cgo_ldflag only allowed in cgo-generated code|no Go files'
|
||||
[compiler:gc] stderr '//go:cgo_ldflag only allowed in cgo-generated code|no Go files'
|
||||
|
||||
rm _cgo_yy.go
|
||||
|
||||
|
8
src/cmd/go/testdata/script/cgo_path.txt
vendored
8
src/cmd/go/testdata/script/cgo_path.txt
vendored
@ -8,10 +8,10 @@
|
||||
[!exec:clang] [!exec:gcc] skip 'Unknown C compiler'
|
||||
|
||||
env GOCACHE=$WORK/gocache # Looking for compile flags, so need a clean cache.
|
||||
[!windows] env PATH=.:$PATH
|
||||
[!windows] chmod 0755 p/gcc p/clang
|
||||
[!windows] exists -exec p/gcc p/clang
|
||||
[windows] exists -exec p/gcc.bat p/clang.bat
|
||||
[!GOOS:windows] env PATH=.:$PATH
|
||||
[!GOOS:windows] chmod 0755 p/gcc p/clang
|
||||
[!GOOS:windows] exists -exec p/gcc p/clang
|
||||
[GOOS:windows] exists -exec p/gcc.bat p/clang.bat
|
||||
! exists p/bug.txt
|
||||
! go build -x
|
||||
stderr '^cgo: C compiler "(clang|gcc)" not found: exec: "(clang|gcc)": cannot run executable found relative to current directory'
|
||||
|
20
src/cmd/go/testdata/script/cgo_path_space.txt
vendored
20
src/cmd/go/testdata/script/cgo_path_space.txt
vendored
@ -10,14 +10,14 @@
|
||||
[exec:gcc] env CC=gcc
|
||||
[!exec:clang] [!exec:gcc] skip 'Unknown C compiler'
|
||||
|
||||
[!windows] chmod 0755 $WORK/'program files'/clang
|
||||
[!windows] chmod 0755 $WORK/'program files'/gcc
|
||||
[!windows] exists -exec $WORK/'program files'/clang
|
||||
[!windows] exists -exec $WORK/'program files'/gcc
|
||||
[!windows] env PATH=$WORK/'program files':$PATH
|
||||
[windows] exists -exec $WORK/'program files'/gcc.bat
|
||||
[windows] exists -exec $WORK/'program files'/clang.bat
|
||||
[windows] env PATH=$WORK\'program files';%PATH%
|
||||
[!GOOS:windows] chmod 0755 $WORK/'program files'/clang
|
||||
[!GOOS:windows] chmod 0755 $WORK/'program files'/gcc
|
||||
[!GOOS:windows] exists -exec $WORK/'program files'/clang
|
||||
[!GOOS:windows] exists -exec $WORK/'program files'/gcc
|
||||
[!GOOS:windows] env PATH=$WORK/'program files':$PATH
|
||||
[GOOS:windows] exists -exec $WORK/'program files'/gcc.bat
|
||||
[GOOS:windows] exists -exec $WORK/'program files'/clang.bat
|
||||
[GOOS:windows] env PATH=$WORK\'program files';%PATH%
|
||||
|
||||
! exists $WORK/log.txt
|
||||
? go build -x
|
||||
@ -28,8 +28,8 @@ rm $WORK/log.txt
|
||||
# contain spaces separating arguments, and it should be possible to quote
|
||||
# arguments with spaces (including the path), as in CGO_CFLAGS and other
|
||||
# variables. For now, this doesn't work.
|
||||
[!windows] env CC=$WORK/'program files'/gcc
|
||||
[windows] env CC=$WORK\'program files'\gcc.bat
|
||||
[!GOOS:windows] env CC=$WORK/'program files'/gcc
|
||||
[GOOS:windows] env CC=$WORK\'program files'\gcc.bat
|
||||
! go build -x
|
||||
! exists $WORK/log.txt
|
||||
|
||||
|
@ -17,8 +17,8 @@ go build -x runtime/cgo
|
||||
[!short] stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
|
||||
|
||||
# https://go.dev/issue/47215: a missing $(go env CC) caused the precompiled net to be stale.
|
||||
[!plan9] env PATH='' # Guaranteed not to include $(go env CC)!
|
||||
[plan9] env path=''
|
||||
[!GOOS:plan9] env PATH='' # Guaranteed not to include $(go env CC)!
|
||||
[GOOS:plan9] env path=''
|
||||
go build -x runtime/cgo
|
||||
! stderr '[/\\]cgo'$GOEXE'["]? .* -importpath runtime/cgo'
|
||||
|
||||
|
@ -4,7 +4,7 @@ env GO111MODULE=off
|
||||
# This test tests that we can link in-package syso files that provides symbols
|
||||
# for cgo. See issue 29253.
|
||||
[!cgo] stop
|
||||
[!gc] stop
|
||||
[!compiler:gc] stop
|
||||
cc -c -o pkg/o.syso ext.c
|
||||
go build main.go
|
||||
|
||||
|
2
src/cmd/go/testdata/script/cover_asm.txt
vendored
2
src/cmd/go/testdata/script/cover_asm.txt
vendored
@ -1,5 +1,5 @@
|
||||
[short] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
# Test cover for a package that has an assembly function.
|
||||
|
||||
|
2
src/cmd/go/testdata/script/cover_cgo.txt
vendored
2
src/cmd/go/testdata/script/cover_cgo.txt
vendored
@ -1,6 +1,6 @@
|
||||
[short] skip
|
||||
[!cgo] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
# Test coverage on cgo code.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[short] skip
|
||||
[!cgo] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
# Test coverage on cgo code. This test case includes an
|
||||
# extra empty non-cgo file in the package being checked.
|
||||
|
@ -1,6 +1,6 @@
|
||||
[short] skip
|
||||
[!cgo] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
# Test coverage on cgo code. This test case has an external
|
||||
# test that tests the code and an in-package test file with
|
||||
|
@ -1,6 +1,6 @@
|
||||
[short] skip
|
||||
[!cgo] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
# Test cgo coverage with an external test.
|
||||
|
||||
|
2
src/cmd/go/testdata/script/cover_dash_c.txt
vendored
2
src/cmd/go/testdata/script/cover_dash_c.txt
vendored
@ -1,5 +1,5 @@
|
||||
[short] skip
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
|
||||
# Test for issue 24588
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
[short] skip
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
|
||||
# coverdep2/p1's xtest imports coverdep2/p2 which imports coverdep2/p1.
|
||||
# Make sure that coverage on coverdep2/p2 recompiles coverdep2/p2.
|
||||
|
@ -1,5 +1,5 @@
|
||||
[short] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
go test -coverpkg=coverdot/a,coverdot/b coverdot/b
|
||||
! stderr '[^0-9]0\.0%'
|
||||
|
2
src/cmd/go/testdata/script/cover_error.txt
vendored
2
src/cmd/go/testdata/script/cover_error.txt
vendored
@ -1,5 +1,5 @@
|
||||
[short] skip
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
|
||||
# Test line numbers in cover errors.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
! go test -n importmain/test
|
||||
stderr 'not an importable package' # check that import main was detected
|
||||
|
2
src/cmd/go/testdata/script/cover_modes.txt
vendored
2
src/cmd/go/testdata/script/cover_modes.txt
vendored
@ -4,7 +4,7 @@ env GO111MODULE=off
|
||||
# and should merge coverage profiles correctly.
|
||||
|
||||
[short] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
go test -short -cover encoding/binary errors -coverprofile=$WORK/cover.out
|
||||
! stderr '[^0-9]0\.0%'
|
||||
|
2
src/cmd/go/testdata/script/cover_pattern.txt
vendored
2
src/cmd/go/testdata/script/cover_pattern.txt
vendored
@ -1,4 +1,4 @@
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
|
||||
# If coverpkg=m/sleepy... expands by package loading
|
||||
# (as opposed to pattern matching on deps)
|
||||
|
2
src/cmd/go/testdata/script/cover_runs.txt
vendored
2
src/cmd/go/testdata/script/cover_runs.txt
vendored
@ -1,4 +1,4 @@
|
||||
[gccgo] skip 'gccgo has no cover tool'
|
||||
[compiler:gccgo] skip 'gccgo has no cover tool'
|
||||
[short] skip
|
||||
|
||||
go test -short -coverpkg=strings strings regexp
|
||||
|
@ -1,5 +1,5 @@
|
||||
[short] skip
|
||||
[gccgo] skip # gccgo has no cover tool
|
||||
[compiler:gccgo] skip # gccgo has no cover tool
|
||||
|
||||
go test -short -cover -covermode=atomic -coverpkg=coverdep/p1 coverdep
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# issue 53314
|
||||
[windows] skip
|
||||
[GOOS:windows] skip
|
||||
cd [pkg]
|
||||
go build
|
||||
|
||||
|
58
src/cmd/go/testdata/script/env_write.txt
vendored
58
src/cmd/go/testdata/script/env_write.txt
vendored
@ -4,14 +4,14 @@ env GO111MODULE=off
|
||||
env AppData=$HOME/windowsappdata
|
||||
env home=$HOME/plan9home
|
||||
go env GOENV
|
||||
[aix] stdout $HOME/.config/go/env
|
||||
[darwin] stdout $HOME'/Library/Application Support/go/env'
|
||||
[freebsd] stdout $HOME/.config/go/env
|
||||
[linux] stdout $HOME/.config/go/env
|
||||
[netbsd] stdout $HOME/.config/go/env
|
||||
[openbsd] stdout $HOME/.config/go/env
|
||||
[plan9] stdout $HOME/plan9home/lib/go/env
|
||||
[windows] stdout $HOME\\windowsappdata\\go\\env
|
||||
[GOOS:aix] stdout $HOME/.config/go/env
|
||||
[GOOS:darwin] stdout $HOME'/Library/Application Support/go/env'
|
||||
[GOOS:freebsd] stdout $HOME/.config/go/env
|
||||
[GOOS:linux] stdout $HOME/.config/go/env
|
||||
[GOOS:netbsd] stdout $HOME/.config/go/env
|
||||
[GOOS:openbsd] stdout $HOME/.config/go/env
|
||||
[GOOS:plan9] stdout $HOME/plan9home/lib/go/env
|
||||
[GOOS:windows] stdout $HOME\\windowsappdata\\go\\env
|
||||
|
||||
# Now override it to something writable.
|
||||
env GOENV=$WORK/envdir/go/env
|
||||
@ -36,7 +36,7 @@ stderr 'go: ''go env -u'' requires an argument'
|
||||
|
||||
# go env -w changes default setting
|
||||
env root=
|
||||
[windows] env root=c:
|
||||
[GOOS:windows] env root=c:
|
||||
env GOPATH=
|
||||
go env -w GOPATH=$root/non-exist/gopath
|
||||
! stderr .+
|
||||
@ -115,43 +115,43 @@ stderr 'go: GOTMPDIR must be an absolute path'
|
||||
|
||||
# go env -w should accept absolute GOTMPDIR value
|
||||
# and should not create it
|
||||
[windows] go env -w GOTMPDIR=$WORK\x\y\z
|
||||
[!windows] go env -w GOTMPDIR=$WORK/x/y/z
|
||||
[GOOS:windows] go env -w GOTMPDIR=$WORK\x\y\z
|
||||
[!GOOS:windows] go env -w GOTMPDIR=$WORK/x/y/z
|
||||
! exists $WORK/x/y/z
|
||||
# we should be able to clear an env
|
||||
go env -u GOTMPDIR
|
||||
go env GOTMPDIR
|
||||
stdout ^$
|
||||
|
||||
[windows] go env -w GOTMPDIR=$WORK\x\y\z
|
||||
[!windows] go env -w GOTMPDIR=$WORK/x/y/z
|
||||
[GOOS:windows] go env -w GOTMPDIR=$WORK\x\y\z
|
||||
[!GOOS:windows] go env -w GOTMPDIR=$WORK/x/y/z
|
||||
go env -w GOTMPDIR=
|
||||
go env GOTMPDIR
|
||||
stdout ^$
|
||||
|
||||
# go env -w rejects relative CC values
|
||||
[!windows] go env -w CC=/usr/bin/clang
|
||||
[!GOOS:windows] go env -w CC=/usr/bin/clang
|
||||
go env -w CC=clang
|
||||
[!windows] ! go env -w CC=./clang
|
||||
[!windows] ! go env -w CC=bin/clang
|
||||
[!windows] stderr 'go: CC entry is relative; must be absolute path'
|
||||
[!GOOS:windows] ! go env -w CC=./clang
|
||||
[!GOOS:windows] ! go env -w CC=bin/clang
|
||||
[!GOOS:windows] stderr 'go: CC entry is relative; must be absolute path'
|
||||
|
||||
[windows] go env -w CC=$WORK\bin\clang
|
||||
[windows] ! go env -w CC=.\clang
|
||||
[windows] ! go env -w CC=bin\clang
|
||||
[windows] stderr 'go: CC entry is relative; must be absolute path'
|
||||
[GOOS:windows] go env -w CC=$WORK\bin\clang
|
||||
[GOOS:windows] ! go env -w CC=.\clang
|
||||
[GOOS:windows] ! go env -w CC=bin\clang
|
||||
[GOOS:windows] stderr 'go: CC entry is relative; must be absolute path'
|
||||
|
||||
# go env -w rejects relative CXX values
|
||||
[!windows] go env -w CC=/usr/bin/cpp
|
||||
[!GOOS:windows] go env -w CC=/usr/bin/cpp
|
||||
go env -w CXX=cpp
|
||||
[!windows] ! go env -w CXX=./cpp
|
||||
[!windows] ! go env -w CXX=bin/cpp
|
||||
[!windows] stderr 'go: CXX entry is relative; must be absolute path'
|
||||
[!GOOS:windows] ! go env -w CXX=./cpp
|
||||
[!GOOS:windows] ! go env -w CXX=bin/cpp
|
||||
[!GOOS:windows] stderr 'go: CXX entry is relative; must be absolute path'
|
||||
|
||||
[windows] go env -w CXX=$WORK\bin\cpp
|
||||
[windows] ! go env -w CXX=.\cpp
|
||||
[windows] ! go env -w CXX=bin\cpp
|
||||
[windows] stderr 'go: CXX entry is relative; must be absolute path'
|
||||
[GOOS:windows] go env -w CXX=$WORK\bin\cpp
|
||||
[GOOS:windows] ! go env -w CXX=.\cpp
|
||||
[GOOS:windows] ! go env -w CXX=bin\cpp
|
||||
[GOOS:windows] stderr 'go: CXX entry is relative; must be absolute path'
|
||||
|
||||
# go env -w/-u checks validity of GOOS/ARCH combinations
|
||||
env GOOS=
|
||||
|
@ -1,6 +1,6 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip 'using -gcflags and -ldflags'
|
||||
[!compiler:gc] skip 'using -gcflags and -ldflags'
|
||||
[short] skip
|
||||
|
||||
env GOCACHE=$WORK/gocache # Looking for compile commands, so need a clean cache.
|
||||
|
@ -1,4 +1,4 @@
|
||||
[windows] skip # skip because windows has no echo command
|
||||
[GOOS:windows] skip # skip because windows has no echo command
|
||||
|
||||
go generate gencycle
|
||||
stdout 'hello world' # check go generate gencycle ran the generator
|
||||
|
4
src/cmd/go/testdata/script/generate_env.txt
vendored
4
src/cmd/go/testdata/script/generate_env.txt
vendored
@ -1,8 +1,8 @@
|
||||
# Install an env command because Windows and plan9 don't have it.
|
||||
env GOBIN=$WORK/tmp/bin
|
||||
go install env.go
|
||||
[plan9] env path=$GOBIN${:}$path
|
||||
[!plan9] env PATH=$GOBIN${:}$PATH
|
||||
[GOOS:plan9] env path=$GOBIN${:}$path
|
||||
[!GOOS:plan9] env PATH=$GOBIN${:}$PATH
|
||||
|
||||
# Test generators have access to the environment
|
||||
go generate ./printenv.go
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
[short] skip
|
||||
|
||||
[!plan9] env PATH=
|
||||
[plan9] env path=
|
||||
[!GOOS:plan9] env PATH=
|
||||
[GOOS:plan9] env path=
|
||||
go generate .
|
||||
|
||||
[!plan9] env PATH=$WORK${/}bin
|
||||
[plan9] env path=$WORK${/}bin
|
||||
[!GOOS:plan9] env PATH=$WORK${/}bin
|
||||
[GOOS:plan9] env path=$WORK${/}bin
|
||||
go generate .
|
||||
|
||||
-- go.mod --
|
||||
|
18
src/cmd/go/testdata/script/get_goroot.txt
vendored
18
src/cmd/go/testdata/script/get_goroot.txt
vendored
@ -28,25 +28,25 @@ stderr '\$GOPATH must not be set to \$GOROOT'
|
||||
mkdir $WORK/home/go
|
||||
|
||||
# Fails because GOROOT=$HOME/go so default GOPATH unset.
|
||||
[windows] env USERPROFILE=$WORK/home
|
||||
[plan9] env home=$WORK/home
|
||||
[!windows] [!plan9] env HOME=$WORK/home
|
||||
[GOOS:windows] env USERPROFILE=$WORK/home
|
||||
[GOOS:plan9] env home=$WORK/home
|
||||
[!GOOS:windows] [!GOOS:plan9] env HOME=$WORK/home
|
||||
env GOPATH=
|
||||
env GOROOT=$WORK/home/go
|
||||
! go get -d github.com/golang/example/hello
|
||||
stderr '\$GOPATH not set'
|
||||
|
||||
[windows] env USERPROFILE=$WORK/home/
|
||||
[plan9] env home=$WORK/home/
|
||||
[!windows] [!plan9] env HOME=$WORK/home/
|
||||
[GOOS:windows] env USERPROFILE=$WORK/home/
|
||||
[GOOS:plan9] env home=$WORK/home/
|
||||
[!GOOS:windows] [!GOOS:plan9] env HOME=$WORK/home/
|
||||
env GOPATH=
|
||||
env GOROOT=$WORK/home/go
|
||||
! go get -d github.com/golang/example/hello
|
||||
stderr '\$GOPATH not set'
|
||||
|
||||
[windows] env USERPROFILE=$WORK/home
|
||||
[plan9] env home=$WORK/home
|
||||
[!windows] [!plan9] env HOME=$WORK/home
|
||||
[GOOS:windows] env USERPROFILE=$WORK/home
|
||||
[GOOS:plan9] env home=$WORK/home
|
||||
[!GOOS:windows] [!GOOS:plan9] env HOME=$WORK/home
|
||||
env GOPATH=
|
||||
env GOROOT=$WORK/home/go/
|
||||
! go get -d github.com/golang/example/hello
|
||||
|
2
src/cmd/go/testdata/script/gopath_local.txt
vendored
2
src/cmd/go/testdata/script/gopath_local.txt
vendored
@ -24,7 +24,7 @@ stdout '^sub\.Hello'
|
||||
! go install testdata/local/easy.go
|
||||
stderr '^go: no install location for \.go files listed on command line \(GOBIN not set\)$'
|
||||
|
||||
[windows] stop # Windows does not allow the ridiculous directory name we're about to use.
|
||||
[GOOS:windows] stop # Windows does not allow the ridiculous directory name we're about to use.
|
||||
|
||||
env BAD_DIR_NAME='#$%:, &()*;<=>?\^{}'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
|
||||
go list -f '{{.Dir}}' vendor/golang.org/x/net/http2/hpack
|
||||
stdout $GOPATH[/\\]src[/\\]vendor
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
|
||||
mkdir $WORK/new/bin
|
||||
|
||||
|
@ -6,7 +6,7 @@ go build mycmd
|
||||
|
||||
# cross-compile install with implicit GOBIN=$GOPATH/bin can make subdirectory
|
||||
env GOARCH=386
|
||||
[386] env GOARCH=amd64
|
||||
[GOARCH:386] env GOARCH=amd64
|
||||
env GOOS=linux
|
||||
go install mycmd
|
||||
exists $GOPATH/bin/linux_$GOARCH/mycmd
|
||||
|
@ -1,12 +1,12 @@
|
||||
# Test that syso in deps is available to cgo.
|
||||
|
||||
[!gc] skip 'requires syso support'
|
||||
[!compiler:gc] skip 'requires syso support'
|
||||
[!cgo] skip
|
||||
[short] skip 'invokes system C compiler'
|
||||
|
||||
# External linking is not supported on linux/ppc64.
|
||||
# See: https://github.com/golang/go/issues/8912
|
||||
[linux] [ppc64] skip
|
||||
[GOOS:linux] [GOARCH:ppc64] skip
|
||||
|
||||
cc -c -o syso/x.syso syso/x.c
|
||||
cc -c -o syso2/x.syso syso2/x.c
|
||||
|
@ -2,13 +2,13 @@
|
||||
# embedded in a package, that is referenced by a Go assembly function.
|
||||
# See issue 33139.
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
[!cgo] skip
|
||||
[short] skip 'invokes system C compiler'
|
||||
|
||||
# External linking is not supported on linux/ppc64.
|
||||
# See: https://github.com/golang/go/issues/8912
|
||||
[linux] [ppc64] skip
|
||||
[GOOS:linux] [GOARCH:ppc64] skip
|
||||
|
||||
cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
|
||||
go build -ldflags='-linkmode=external' ./cmd/main.go
|
||||
|
2
src/cmd/go/testdata/script/linkname.txt
vendored
2
src/cmd/go/testdata/script/linkname.txt
vendored
@ -1,7 +1,7 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
# check for linker name in error message about linker crash
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
! go build -ldflags=-crash_for_testing x.go
|
||||
stderr [\\/]tool[\\/].*[\\/]link
|
||||
|
||||
|
@ -22,9 +22,9 @@ stderr '^stat .*[/\\]foo\.go[/\\]b\.go: directory not found$'
|
||||
# Multiple patterns for Go files with a typo. This should
|
||||
# treat the wrong pattern as if it were a nonexistent file.
|
||||
! go list ./foo.go/a.go ./foo.go/b.go
|
||||
[plan9] stderr 'stat ./foo.go/b.go: ''./foo.go/b.go'' does not exist'
|
||||
[windows] stderr './foo.go/b.go: The system cannot find the file specified'
|
||||
[!plan9] [!windows] stderr './foo.go/b.go: no such file or directory'
|
||||
[GOOS:plan9] stderr 'stat ./foo.go/b.go: ''./foo.go/b.go'' does not exist'
|
||||
[GOOS:windows] stderr './foo.go/b.go: The system cannot find the file specified'
|
||||
[!GOOS:plan9] [!GOOS:windows] stderr './foo.go/b.go: no such file or directory'
|
||||
|
||||
-- a.go --
|
||||
package main
|
||||
|
@ -36,8 +36,8 @@ env GO111MODULE=off
|
||||
go list ./...
|
||||
stdout -count=2 '^.+$' # Both 'fmt' and GOROOT/src should be listed.
|
||||
stdout '^fmt$'
|
||||
[!windows] stdout ^_$WORK/goroot/src$
|
||||
[windows] stdout goroot/src$ # On windows the ":" in the volume name is mangled
|
||||
[!GOOS:windows] stdout ^_$WORK/goroot/src$
|
||||
[GOOS:windows] stdout goroot/src$ # On windows the ":" in the volume name is mangled
|
||||
|
||||
go list ...
|
||||
! stdout goroot/src
|
||||
@ -46,8 +46,8 @@ go list std
|
||||
! stdout goroot/src
|
||||
|
||||
go list .
|
||||
[!windows] stdout ^_$WORK/goroot/src$
|
||||
[windows] stdout goroot/src$
|
||||
[!GOOS:windows] stdout ^_$WORK/goroot/src$
|
||||
[GOOS:windows] stdout goroot/src$
|
||||
|
||||
# switch to GOPATH/src
|
||||
cd $GOPATH/src
|
||||
@ -55,8 +55,8 @@ cd $GOPATH/src
|
||||
# GO111MODULE=off,GOPATH
|
||||
env GO111MODULE=off
|
||||
go list ./...
|
||||
[!windows] stdout ^_$WORK/gopath/src$
|
||||
[windows] stdout gopath/src$
|
||||
[!GOOS:windows] stdout ^_$WORK/gopath/src$
|
||||
[GOOS:windows] stdout gopath/src$
|
||||
|
||||
go list all
|
||||
! stdout gopath/src
|
||||
|
@ -1,7 +1,7 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
# gccgo does not have standard packages.
|
||||
[gccgo] skip
|
||||
[compiler:gccgo] skip
|
||||
|
||||
# fmt should have no rewritten imports.
|
||||
# The import from a/b should map c/d to a's vendor directory.
|
||||
|
4
src/cmd/go/testdata/script/list_perm.txt
vendored
4
src/cmd/go/testdata/script/list_perm.txt
vendored
@ -16,8 +16,8 @@ stderr 'matched no packages'
|
||||
# equivalent to an empty directory).
|
||||
|
||||
[root] stop # Root typically ignores file permissions.
|
||||
[windows] skip # Does not have Unix-style directory permissions.
|
||||
[plan9] skip # Might not have Unix-style directory permissions.
|
||||
[GOOS:windows] skip # Does not have Unix-style directory permissions.
|
||||
[GOOS:plan9] skip # Might not have Unix-style directory permissions.
|
||||
|
||||
chmod 000 noread
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# whether the modindex logic cleans the modroot path before using
|
||||
# it.
|
||||
|
||||
[!windows] skip
|
||||
[!GOOS:windows] skip
|
||||
[short] skip
|
||||
|
||||
go run print_go_mod.go # use this program to write a go.mod with an absolute path
|
||||
|
2
src/cmd/go/testdata/script/list_std.txt
vendored
2
src/cmd/go/testdata/script/list_std.txt
vendored
@ -1,6 +1,6 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
[short] skip
|
||||
|
||||
# Listing GOROOT should only find standard packages.
|
||||
|
4
src/cmd/go/testdata/script/list_swigcxx.txt
vendored
4
src/cmd/go/testdata/script/list_swigcxx.txt
vendored
@ -16,8 +16,8 @@
|
||||
go list -f '{{.CompiledGoFiles}}' -compiled=true example/swig
|
||||
|
||||
stdout a\.go
|
||||
[gc] stdout -count=3 $GOCACHE
|
||||
[gccgo] stdout -count=2 $GOCACHE
|
||||
[compiler:gc] stdout -count=3 $GOCACHE
|
||||
[compiler:gccgo] stdout -count=2 $GOCACHE
|
||||
|
||||
-- go.mod --
|
||||
module example
|
||||
|
10
src/cmd/go/testdata/script/mod_cache_rw.txt
vendored
10
src/cmd/go/testdata/script/mod_cache_rw.txt
vendored
@ -17,10 +17,10 @@ cp $WORK/extraneous.txt $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/extraneous_file.go
|
||||
|
||||
# If all 'go' commands ran with the flag, the system's 'rm' binary
|
||||
# should be able to remove the module cache if the '-rf' flags are set.
|
||||
[!windows] [exec:rm] exec rm -rf $GOPATH/pkg/mod
|
||||
[!windows] [!exec:rm] go clean -modcache
|
||||
[windows] [exec:cmd.exe] exec cmd.exe /c rmdir /s /q $GOPATH\pkg\mod
|
||||
[windows] [!exec:cmd.exe] go clean -modcache
|
||||
[!GOOS:windows] [exec:rm] exec rm -rf $GOPATH/pkg/mod
|
||||
[!GOOS:windows] [!exec:rm] go clean -modcache
|
||||
[GOOS:windows] [exec:cmd.exe] exec cmd.exe /c rmdir /s /q $GOPATH\pkg\mod
|
||||
[GOOS:windows] [!exec:cmd.exe] go clean -modcache
|
||||
! exists $GOPATH/pkg/mod
|
||||
|
||||
# The directories in the module cache should by default be unwritable,
|
||||
@ -30,7 +30,7 @@ cp $WORK/extraneous.txt $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/extraneous_file.go
|
||||
# unwritable.
|
||||
go get rsc.io/quote@latest
|
||||
[!root] ! cp $WORK/extraneous.txt $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/go.mod
|
||||
[!windows] [!root] ! cp $WORK/extraneous.txt $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/extraneous_file.go
|
||||
[!GOOS:windows] [!root] ! cp $WORK/extraneous.txt $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/extraneous_file.go
|
||||
! exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/extraneous_file.go
|
||||
|
||||
|
||||
|
2
src/cmd/go/testdata/script/mod_doc_path.txt
vendored
2
src/cmd/go/testdata/script/mod_doc_path.txt
vendored
@ -4,7 +4,7 @@
|
||||
# Remove 'go' from $PATH. (It can still be located via $GOROOT/bin/go, and the
|
||||
# test script's built-in 'go' command still knows where to find it.)
|
||||
env PATH=''
|
||||
[plan9] env path=''
|
||||
[GOOS:plan9] env path=''
|
||||
|
||||
go doc p.X
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Since 1.16, we extract to the final directory, but we create a .partial file
|
||||
# so that if we crash, other processes know the directory is incomplete.
|
||||
|
||||
[!windows] skip
|
||||
[!GOOS:windows] skip
|
||||
[short] skip
|
||||
|
||||
go run downloader.go
|
||||
|
@ -1,7 +1,7 @@
|
||||
[short] skip
|
||||
[!git] skip
|
||||
[!net] skip
|
||||
[!linux] skip # Uses XDG_CONFIG_HOME
|
||||
[!GOOS:linux] skip # Uses XDG_CONFIG_HOME
|
||||
|
||||
env GIT_CONFIG_GLOBAL=$WORK/.gitconfig
|
||||
env GOPROXY=direct
|
||||
|
@ -12,11 +12,11 @@ grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
|
||||
|
||||
# Use download cache as file:/// proxy.
|
||||
env GOPATH=$WORK/gopath2
|
||||
[windows] env GOPROXY=file:///C:/nonexist
|
||||
[!windows] env GOPROXY=file:///nonexist
|
||||
[GOOS:windows] env GOPROXY=file:///C:/nonexist
|
||||
[!GOOS:windows] env GOPROXY=file:///nonexist
|
||||
! go list
|
||||
[windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download
|
||||
[!windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download
|
||||
go list
|
||||
grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
|
||||
|
||||
|
@ -9,8 +9,8 @@ cd $WORK/x
|
||||
go mod tidy
|
||||
|
||||
# Use download cache as file:/// proxy.
|
||||
[windows] env GOPROXY=file:///$WORK/gopath/pkg/mod/cache/download
|
||||
[!windows] env GOPROXY=file://$WORK/gopath/pkg/mod/cache/download
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/gopath/pkg/mod/cache/download
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/gopath/pkg/mod/cache/download
|
||||
rm $WORK/gopath/pkg/mod/cache/download/golang.org/x/text/
|
||||
go mod tidy -e
|
||||
stderr '^go: rsc.io/sampler@v1.3.0 requires\n\tgolang.org/x/text@.*: reading file://.*/pkg/mod/cache/download/golang.org/x/text/.*'
|
||||
@ -39,4 +39,4 @@ import (
|
||||
|
||||
func Echo() {
|
||||
fmt.Println(quote.Hello())
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.0.0.info
|
||||
grep '{"Version":"v1.0.0","Time":"2018-02-14T00:45:20Z"}' $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.0.0.info
|
||||
|
||||
# If neither GOMODCACHE or GOPATH are set, GOPATH defaults to the user's $HOME/go, so GOMODCACHE becomes $HOME/go/pkg/mod
|
||||
[windows] env USERPROFILE=$WORK/home # Ensure USERPROFILE is a valid path (rather than /no-home/ so we don't run into the logic that "uninfers" GOPATH in cmd/go/main.go
|
||||
[plan9] env home=$WORK/home
|
||||
[!windows] [!plan9] env HOME=$WORK/home
|
||||
[GOOS:windows] env USERPROFILE=$WORK/home # Ensure USERPROFILE is a valid path (rather than /no-home/ so we don't run into the logic that "uninfers" GOPATH in cmd/go/main.go
|
||||
[GOOS:plan9] env home=$WORK/home
|
||||
[!GOOS:windows] [!GOOS:plan9] env HOME=$WORK/home
|
||||
env GOMODCACHE=
|
||||
env GOPATH=
|
||||
go env GOMODCACHE
|
||||
|
2
src/cmd/go/testdata/script/mod_list_std.txt
vendored
2
src/cmd/go/testdata/script/mod_list_std.txt
vendored
@ -1,7 +1,7 @@
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=off
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
[short] skip
|
||||
|
||||
# Outside of GOROOT, our vendored packages should be reported as part of the standard library.
|
||||
|
4
src/cmd/go/testdata/script/mod_perm.txt
vendored
4
src/cmd/go/testdata/script/mod_perm.txt
vendored
@ -5,8 +5,8 @@ go list ./...
|
||||
# skip in conditions where chmod 0 may not work.
|
||||
# plan9 should be fine, but copied from list_perm.txt unchanged.
|
||||
[root] skip
|
||||
[windows] skip
|
||||
[plan9] skip
|
||||
[GOOS:windows] skip
|
||||
[GOOS:plan9] skip
|
||||
|
||||
# go list should work with unreadable _data directory.
|
||||
chmod 0 _data
|
||||
|
@ -5,8 +5,8 @@ env GO111MODULE=on
|
||||
[short] skip
|
||||
|
||||
# Skip platforms that do not have Unix-style file permissions.
|
||||
[windows] skip
|
||||
[plan9] skip
|
||||
[GOOS:windows] skip
|
||||
[GOOS:plan9] skip
|
||||
|
||||
chmod 0640 go.mod
|
||||
chmod 0604 go.sum
|
||||
|
@ -1,7 +1,7 @@
|
||||
env GO111MODULE=on
|
||||
env GOPROXY=off
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
|
||||
# 'go list' should report imports from _test.go in the TestImports field.
|
||||
go list -f '{{.TestImports}}'
|
||||
|
@ -10,23 +10,23 @@ env GOPATH=$WORK/gopath1
|
||||
#
|
||||
# TODO(bcmills): The error message here is a bit redundant.
|
||||
# It comes from the sumweb package, which isn't yet producing structured errors.
|
||||
[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
|
||||
[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
|
||||
! go get golang.org/x/text@v0.3.2
|
||||
stderr '^go: golang.org/x/text@v0.3.2: verifying module: golang.org/x/text@v0.3.2: reading file://.*/sumdb/sum.golang.org/lookup/golang.org/x/text@v0.3.2: (no such file or directory|.*cannot find the path specified.*)'
|
||||
|
||||
# If the proxy does not claim to support the database,
|
||||
# checksum verification should fall through to the next proxy,
|
||||
# and downloading should succeed.
|
||||
[windows] env GOPROXY=file:///$WORK/emptyproxy,https://proxy.golang.org
|
||||
[!windows] env GOPROXY=file://$WORK/emptyproxy,https://proxy.golang.org
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/emptyproxy,https://proxy.golang.org
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/emptyproxy,https://proxy.golang.org
|
||||
go get golang.org/x/text@v0.3.2
|
||||
|
||||
# After a successful sumdb lookup, the lookup can be repeated
|
||||
# using the download cache as a proxy.
|
||||
cp supported $GOPATH/pkg/mod/cache/download/sumdb/sum.golang.org/supported
|
||||
[windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download,file:///$WORK/sumproxy
|
||||
[!windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download,file://$WORK/sumproxy
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/gopath1/pkg/mod/cache/download,file:///$WORK/sumproxy
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download,file://$WORK/sumproxy
|
||||
env GOPATH=$WORK/gopath2
|
||||
rm go.sum
|
||||
go get -x -v golang.org/x/text@v0.3.2
|
||||
@ -36,11 +36,11 @@ go get -x -v golang.org/x/text@v0.3.2
|
||||
# a fallback module mirror.
|
||||
grep golang.org/x/text go.sum
|
||||
env GOPATH=$WORK/gopath3
|
||||
[windows] env GOPROXY=file:///$WORK/sumproxy
|
||||
[!windows] env GOPROXY=file://$WORK/sumproxy
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy
|
||||
! go get golang.org/x/text@v0.3.2
|
||||
[windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
|
||||
[!windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
|
||||
[GOOS:windows] env GOPROXY=file:///$WORK/sumproxy,https://proxy.golang.org
|
||||
[!GOOS:windows] env GOPROXY=file://$WORK/sumproxy,https://proxy.golang.org
|
||||
go get golang.org/x/text@v0.3.2
|
||||
|
||||
-- supported --
|
||||
|
2
src/cmd/go/testdata/script/mod_tidy_temp.txt
vendored
2
src/cmd/go/testdata/script/mod_tidy_temp.txt
vendored
@ -4,7 +4,7 @@
|
||||
# 1. /tmp/go.mod exists
|
||||
# 2. run 'go mod tidy' in /tmp or in the child directory not having go.mod.
|
||||
|
||||
[plan9] stop # Plan 9 has no $TMPDIR variable to set.
|
||||
[GOOS:plan9] stop # Plan 9 has no $TMPDIR variable to set.
|
||||
|
||||
env GOROOT=$TESTGO_GOROOT
|
||||
env TMP=$WORK
|
||||
|
2
src/cmd/go/testdata/script/std_vendor.txt
vendored
2
src/cmd/go/testdata/script/std_vendor.txt
vendored
@ -1,6 +1,6 @@
|
||||
env GO111MODULE=off
|
||||
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
|
||||
# 'go list' should report imports from _test.go in the TestImports field.
|
||||
go list -f '{{.TestImports}}'
|
||||
|
@ -1,6 +1,6 @@
|
||||
[short] skip 'links and runs a test binary'
|
||||
[!fuzz] skip 'tests SIGINT behavior for interrupting fuzz tests'
|
||||
[windows] skip 'windows does not support os.Interrupt'
|
||||
[GOOS:windows] skip 'windows does not support os.Interrupt'
|
||||
|
||||
? go test -json -fuzz FuzzInterrupt -run '^$' -parallel 1
|
||||
stdout -count=1 '"Action":"pass","Package":"example","Test":"FuzzInterrupt"'
|
||||
@ -52,4 +52,4 @@ func FuzzInterrupt(f *testing.F) {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# TODO(jayconrod): support shared memory on more platforms.
|
||||
[!darwin] [!linux] [!windows] skip
|
||||
[!GOOS:darwin] [!GOOS:linux] [!GOOS:windows] skip
|
||||
|
||||
# Verify that the fuzzing engine records the actual crashing input, even when
|
||||
# a worker process terminates without communicating the crashing input back
|
||||
|
@ -1,6 +1,6 @@
|
||||
# NOTE: this test is skipped on Windows, since there's no concept of signals.
|
||||
# When a process terminates another process, it provides an exit code.
|
||||
[windows] skip
|
||||
[GOOS:windows] skip
|
||||
[!fuzz] skip
|
||||
[short] skip
|
||||
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
[short] skip
|
||||
|
||||
[!plan9] env PATH=
|
||||
[plan9] env path=
|
||||
[!GOOS:plan9] env PATH=
|
||||
[GOOS:plan9] env path=
|
||||
go test .
|
||||
|
||||
[!plan9] env PATH=$WORK${/}bin
|
||||
[plan9] env path=$WORK${/}bin
|
||||
[!GOOS:plan9] env PATH=$WORK${/}bin
|
||||
[GOOS:plan9] env path=$WORK${/}bin
|
||||
go test .
|
||||
|
||||
-- go.mod --
|
||||
|
2
src/cmd/go/testdata/script/test_json.txt
vendored
2
src/cmd/go/testdata/script/test_json.txt
vendored
@ -1,4 +1,4 @@
|
||||
[gccgo] skip # gccgo does not have standard packages
|
||||
[compiler:gccgo] skip # gccgo does not have standard packages
|
||||
[short] skip
|
||||
|
||||
env GOCACHE=$WORK/tmp
|
||||
|
@ -5,10 +5,10 @@
|
||||
# -Os option.
|
||||
#
|
||||
# Verifies golang.org/issue/52366 for linux/ppc64le
|
||||
[!linux] skip
|
||||
[!gc] skip
|
||||
[!GOOS:linux] skip
|
||||
[!compiler:gc] skip
|
||||
[!cgo] skip
|
||||
[!ppc64le] skip
|
||||
[!GOARCH:ppc64le] skip
|
||||
|
||||
go build -ldflags='-linkmode=internal'
|
||||
exec ./abitest
|
||||
|
@ -8,9 +8,9 @@
|
||||
#
|
||||
# Note, older gcc/clang may accept this option, but
|
||||
# ignore it if binutils does not support the relocs.
|
||||
[!gc] skip
|
||||
[!compiler:gc] skip
|
||||
[!cgo] skip
|
||||
[!ppc64le] skip
|
||||
[!GOARCH:ppc64le] skip
|
||||
|
||||
env CGO_CFLAGS='-fno-plt -O2 -g'
|
||||
|
||||
|
2
src/cmd/go/testdata/script/test_profile.txt
vendored
2
src/cmd/go/testdata/script/test_profile.txt
vendored
@ -1,4 +1,4 @@
|
||||
[gccgo] skip 'gccgo has no standard packages'
|
||||
[compiler:gccgo] skip 'gccgo has no standard packages'
|
||||
[short] skip
|
||||
|
||||
# Check go test -cpuprofile creates errors.test
|
||||
|
2
src/cmd/go/testdata/script/toolexec.txt
vendored
2
src/cmd/go/testdata/script/toolexec.txt
vendored
@ -17,7 +17,7 @@ env GOCACHE=$WORK/gocache
|
||||
# Finally, note that asm and cgo are run twice.
|
||||
|
||||
go build -toolexec=$PWD/mytool
|
||||
[amd64] stderr -count=2 '^asm'${GOEXE}' TOOLEXEC_IMPORTPATH="test/main/withasm"$'
|
||||
[GOARCH:amd64] stderr -count=2 '^asm'${GOEXE}' TOOLEXEC_IMPORTPATH="test/main/withasm"$'
|
||||
stderr -count=1 '^compile'${GOEXE}' TOOLEXEC_IMPORTPATH="test/main/withasm"$'
|
||||
[cgo] stderr -count=2 '^cgo'${GOEXE}' TOOLEXEC_IMPORTPATH="test/main/withcgo"$'
|
||||
[cgo] stderr -count=1 '^compile'${GOEXE}' TOOLEXEC_IMPORTPATH="test/main/withcgo"$'
|
||||
|
@ -1,4 +1,4 @@
|
||||
[!windows] [short] stop 'this test only applies to Windows'
|
||||
[!GOOS:windows] [short] stop 'this test only applies to Windows'
|
||||
env GO111MODULE=off
|
||||
|
||||
go build run_go.go
|
||||
|
4
src/cmd/go/testdata/script/version.txt
vendored
4
src/cmd/go/testdata/script/version.txt
vendored
@ -69,8 +69,8 @@ stdout '^\tmod\trsc.io/fortune\tv1.0.0'
|
||||
|
||||
# Also test PIE with internal linking.
|
||||
# currently only supported on linux/amd64, linux/arm64 and windows/amd64.
|
||||
[!linux] [!windows] stop
|
||||
[!amd64] [!arm64] stop
|
||||
[!GOOS:linux] [!GOOS:windows] stop
|
||||
[!GOARCH:amd64] [!GOARCH:arm64] stop
|
||||
go build -buildmode=pie -ldflags=-linkmode=internal -o internal.exe rsc.io/fortune
|
||||
go version internal.exe
|
||||
stdout '^internal.exe: .+'
|
||||
|
@ -6,7 +6,7 @@ go version -m m$GOEXE
|
||||
stdout '^\tbuild\t-compiler=gc$'
|
||||
stdout '^\tbuild\tGOOS='
|
||||
stdout '^\tbuild\tGOARCH='
|
||||
[amd64] stdout '^\tbuild\tGOAMD64='
|
||||
[GOARCH:amd64] stdout '^\tbuild\tGOAMD64='
|
||||
! stdout asmflags|gcflags|ldflags|gccgoflags
|
||||
|
||||
# Toolchain flags are added if present.
|
||||
|
@ -3,15 +3,15 @@
|
||||
# The Git test covers common functionality.
|
||||
|
||||
# "fossil" is the Fossil file server on Plan 9.
|
||||
[plan9] skip
|
||||
[GOOS:plan9] skip
|
||||
[!exec:fossil] skip
|
||||
[short] skip
|
||||
env GOBIN=$WORK/gopath/bin
|
||||
env oldpath=$PATH
|
||||
env HOME=$WORK
|
||||
env USER=gopher
|
||||
[!windows] env fslckout=.fslckout
|
||||
[windows] env fslckout=_FOSSIL_
|
||||
[!GOOS:windows] env fslckout=.fslckout
|
||||
[GOOS:windows] env fslckout=_FOSSIL_
|
||||
exec pwd
|
||||
exec fossil init repo.fossil
|
||||
cd repo/a
|
||||
|
2
src/cmd/go/testdata/script/vet_asm.txt
vendored
2
src/cmd/go/testdata/script/vet_asm.txt
vendored
@ -2,7 +2,7 @@ env GO111MODULE=off
|
||||
|
||||
# Issue 27665. Verify that "go vet" analyzes non-Go files.
|
||||
|
||||
[!amd64] skip
|
||||
[!GOARCH:amd64] skip
|
||||
! go vet -asmdecl a
|
||||
stderr 'f: invalid MOVW of x'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user