github.com/rafaeltorres324/go/src@v0.0.0-20210519164414-9fdf653a9838/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 27 # We disallow local import for non-local packages, if $GOROOT happens 28 # to be under $GOPATH, then some tests below will fail. $GOPATH needs 29 # to be set to a non-empty string, else Go will set a default value 30 # that may also conflict with $GOROOT. The $GOPATH value doesn't need 31 # to point to an actual directory, it just needs to pass the semantic 32 # checks performed by Go. Use $GOROOT to define $GOPATH so that we 33 # don't blunder into a user-defined symbolic link. 34 export GOPATH=/dev/null 35 36 unset CDPATH # in case user has it set 37 export GOBIN=$GOROOT/bin # Issue 14340 38 unset GOFLAGS 39 unset GO111MODULE 40 41 export GOHOSTOS 42 export CC 43 44 # no core files, please 45 ulimit -c 0 46 47 # Raise soft limits to hard limits for NetBSD/OpenBSD. 48 # We need at least 256 files and ~300 MB of bss. 49 # On OS X ulimit -S -n rejects 'unlimited'. 50 # 51 # Note that ulimit -S -n may fail if ulimit -H -n is set higher than a 52 # non-root process is allowed to set the high limit. 53 # This is a system misconfiguration and should be fixed on the 54 # broken system, not "fixed" by ignoring the failure here. 55 # See longer discussion on golang.org/issue/7381. 56 [ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n) 57 [ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d) 58 59 # Thread count limit on NetBSD 7. 60 if ulimit -T &> /dev/null; then 61 [ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T) 62 fi 63 64 exec ../bin/go tool dist test -rebuild "$@"