]> Cypherpunks.ru repositories - gostls13.git/blob - src/run.bash
cmd/dist: move more environment logic into cmd/dist from make and run scripts
[gostls13.git] / src / 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 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 tool dist env)
25 export GOROOT   # The api test requires GOROOT to be set, so set it to match ../bin/go.
26
27 unset CDPATH    # in case user has it set
28
29 export GOHOSTOS
30 export CC
31
32 # no core files, please
33 ulimit -c 0
34
35 # Raise soft limits to hard limits for NetBSD/OpenBSD.
36 # We need at least 256 files and ~300 MB of bss.
37 # On OS X ulimit -S -n rejects 'unlimited'.
38 #
39 # Note that ulimit -S -n may fail if ulimit -H -n is set higher than a
40 # non-root process is allowed to set the high limit.
41 # This is a system misconfiguration and should be fixed on the
42 # broken system, not "fixed" by ignoring the failure here.
43 # See longer discussion on golang.org/issue/7381.
44 [ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n)
45 [ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d)
46
47 # Thread count limit on NetBSD 7.
48 if ulimit -T &> /dev/null; then
49         [ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
50 fi
51
52 export GOPATH=/nonexist-gopath
53 exec ../bin/go tool dist test -rebuild "$@"