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