Devon H. O'Dell | 553be84 | 2009-11-14 15:29:09 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Russ Cox | bbb00c6 | 2008-10-08 09:46:54 -0700 | [diff] [blame] | 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 | set -e |
| 7 | |
Shenghou Ma | 6d4da06 | 2012-03-10 03:42:23 +0800 | [diff] [blame] | 8 | eval $(go env) |
Shenghou Ma | 6f3f2d0 | 2014-04-29 14:43:10 -0400 | [diff] [blame] | 9 | export GOROOT # the api test requires GOROOT to be set. |
Russ Cox | 8290536 | 2012-02-04 00:54:08 -0500 | [diff] [blame] | 10 | |
Russ Cox | 69fd2a4 | 2010-03-31 19:48:33 -0700 | [diff] [blame] | 11 | unset CDPATH # in case user has it set |
Shenghou Ma | 23322ab | 2012-03-21 00:47:27 +0800 | [diff] [blame] | 12 | unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens |
| 13 | # to be under $GOPATH, then some tests below will fail |
Devon H. O'Dell | 857d4cf | 2009-12-11 15:14:09 -0800 | [diff] [blame] | 14 | |
Brad Fitzpatrick | d5f6906 | 2015-03-02 17:07:11 -0800 | [diff] [blame] | 15 | export GOHOSTOS |
| 16 | export CC |
| 17 | |
Russ Cox | da77679 | 2009-11-09 23:11:36 -0800 | [diff] [blame] | 18 | # no core files, please |
| 19 | ulimit -c 0 |
| 20 | |
Shenghou Ma | 329b27a | 2012-09-17 01:11:28 +0800 | [diff] [blame] | 21 | # Raise soft limits to hard limits for NetBSD/OpenBSD. |
| 22 | # We need at least 256 files and ~300 MB of bss. |
| 23 | # On OS X ulimit -S -n rejects 'unlimited'. |
Russ Cox | e6e8945 | 2014-02-24 16:44:35 -0500 | [diff] [blame] | 24 | # |
| 25 | # Note that ulimit -S -n may fail if ulimit -H -n is set higher than a |
| 26 | # non-root process is allowed to set the high limit. |
| 27 | # This is a system misconfiguration and should be fixed on the |
| 28 | # broken system, not "fixed" by ignoring the failure here. |
| 29 | # See longer discussion on golang.org/issue/7381. |
Shenghou Ma | 329b27a | 2012-09-17 01:11:28 +0800 | [diff] [blame] | 30 | [ "$(ulimit -H -n)" == "unlimited" ] || ulimit -S -n $(ulimit -H -n) |
Shenghou Ma | a1a414e | 2012-09-17 01:26:57 +0800 | [diff] [blame] | 31 | [ "$(ulimit -H -d)" == "unlimited" ] || ulimit -S -d $(ulimit -H -d) |
Shenghou Ma | 329b27a | 2012-09-17 01:11:28 +0800 | [diff] [blame] | 32 | |
Benny Siegert | 8a4efed | 2013-06-17 19:31:58 +1000 | [diff] [blame] | 33 | # Thread count limit on NetBSD 7. |
| 34 | if ulimit -T &> /dev/null; then |
| 35 | [ "$(ulimit -H -T)" == "unlimited" ] || ulimit -S -T $(ulimit -H -T) |
| 36 | fi |
| 37 | |
Rahul Chaudhry | d9f6919 | 2015-05-08 12:18:52 -0700 | [diff] [blame] | 38 | exec go tool dist test "$@" |