Home | History | Annotate | Download | only in src
      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 set -e
      7 
      8 eval $(go env)
      9 export GOROOT   # the api test requires GOROOT to be set.
     10 
     11 unset CDPATH	# in case user has it set
     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
     14 
     15 export GOHOSTOS
     16 export CC
     17 
     18 # no core files, please
     19 ulimit -c 0
     20 
     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'.
     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. 
     30 [ "$(ulimit -H -n)" == "unlimited" ] || ulimit -S -n $(ulimit -H -n)
     31 [ "$(ulimit -H -d)" == "unlimited" ] || ulimit -S -d $(ulimit -H -d)
     32 
     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 
     38 exec go tool dist test "$@"
     39