github.com/m10x/go/src@v0.0.0-20220112094212-ba61592315da/run.bash (about) 1 #!/usr/bin/env bash 2 # Copyright 2009 The Go Authors. All rights reserved. 3 # Use of this source code is governed by a BSD-style 4 # license that can be found in the LICENSE file. 5 6 # Environment variables that control run.bash: 7 # 8 # GO_TEST_SHARDS: number of "dist test" test shards that the 9 # $GOROOT/test directory will be sliced up into for parallel 10 # execution. Defaults to 1, unless GO_BUILDER_NAME is also specified, 11 # in which case it defaults to 10. 12 # 13 # GO_BUILDER_NAME: the name of the Go builder that's running the tests. 14 # Some tests are conditionally enabled or disabled based on the builder 15 # name or the builder name being non-empty. 16 17 set -e 18 19 if [ ! -f ../bin/go ]; then 20 echo 'run.bash must be run from $GOROOT/src after installing cmd/go' 1>&2 21 exit 1 22 fi 23 24 eval $(../bin/go env) 25 export GOROOT # The api test requires GOROOT to be set, so set it to match ../bin/go. 26 export GOPATH=/nonexist-gopath 27 28 unset CDPATH # in case user has it set 29 export GOBIN=$GOROOT/bin # Issue 14340 30 unset GOFLAGS 31 unset GO111MODULE 32 33 export GOHOSTOS 34 export CC 35 36 # no core files, please 37 ulimit -c 0 38 39 # Raise soft limits to hard limits for NetBSD/OpenBSD. 40 # We need at least 256 files and ~300 MB of bss. 41 # On OS X ulimit -S -n rejects 'unlimited'. 42 # 43 # Note that ulimit -S -n may fail if ulimit -H -n is set higher than a 44 # non-root process is allowed to set the high limit. 45 # This is a system misconfiguration and should be fixed on the 46 # broken system, not "fixed" by ignoring the failure here. 47 # See longer discussion on golang.org/issue/7381. 48 [ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n) 49 [ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d) 50 51 # Thread count limit on NetBSD 7. 52 if ulimit -T &> /dev/null; then 53 [ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T) 54 fi 55 56 exec ../bin/go tool dist test -rebuild "$@"