2009-11-14 16:29:09 -07:00
|
|
|
#!/usr/bin/env bash
|
2008-10-08 10:46:54 -06:00
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2012-03-09 12:42:23 -07:00
|
|
|
eval $(go env)
|
2014-04-29 12:43:10 -06:00
|
|
|
export GOROOT # the api test requires GOROOT to be set.
|
2012-02-03 22:54:08 -07:00
|
|
|
|
2010-03-31 20:48:33 -06:00
|
|
|
unset CDPATH # in case user has it set
|
2012-03-20 10:47:27 -06:00
|
|
|
unset GOPATH # we disallow local import for non-local packages, if $GOROOT happens
|
|
|
|
# to be under $GOPATH, then some tests below will fail
|
2009-12-11 16:14:09 -07:00
|
|
|
|
2015-03-02 18:07:11 -07:00
|
|
|
export GOHOSTOS
|
|
|
|
export CC
|
|
|
|
|
2009-11-10 00:11:36 -07:00
|
|
|
# no core files, please
|
|
|
|
ulimit -c 0
|
|
|
|
|
2012-09-16 11:11:28 -06:00
|
|
|
# Raise soft limits to hard limits for NetBSD/OpenBSD.
|
|
|
|
# We need at least 256 files and ~300 MB of bss.
|
|
|
|
# On OS X ulimit -S -n rejects 'unlimited'.
|
2014-02-24 14:44:35 -07:00
|
|
|
#
|
|
|
|
# Note that ulimit -S -n may fail if ulimit -H -n is set higher than a
|
|
|
|
# non-root process is allowed to set the high limit.
|
|
|
|
# This is a system misconfiguration and should be fixed on the
|
|
|
|
# broken system, not "fixed" by ignoring the failure here.
|
|
|
|
# See longer discussion on golang.org/issue/7381.
|
2012-09-16 11:11:28 -06:00
|
|
|
[ "$(ulimit -H -n)" == "unlimited" ] || ulimit -S -n $(ulimit -H -n)
|
2012-09-16 11:26:57 -06:00
|
|
|
[ "$(ulimit -H -d)" == "unlimited" ] || ulimit -S -d $(ulimit -H -d)
|
2012-09-16 11:11:28 -06:00
|
|
|
|
2013-06-17 03:31:58 -06:00
|
|
|
# Thread count limit on NetBSD 7.
|
|
|
|
if ulimit -T &> /dev/null; then
|
|
|
|
[ "$(ulimit -H -T)" == "unlimited" ] || ulimit -S -T $(ulimit -H -T)
|
|
|
|
fi
|
|
|
|
|
2015-03-02 18:07:11 -07:00
|
|
|
exec go tool dist test $@
|