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
|
|
|
|
2017-02-22 07:56:26 -07:00
|
|
|
# We disallow local import for non-local packages, if $GOROOT happens
|
|
|
|
# to be under $GOPATH, then some tests below will fail. $GOPATH needs
|
|
|
|
# to be set to a non-empty string, else Go will set a default value
|
|
|
|
# that may also conflict with $GOROOT. The $GOPATH value doesn't need
|
|
|
|
# to point to an actual directory, it just needs to pass the semantic
|
|
|
|
# checks performed by Go. Use $GOROOT to define $GOPATH so that we
|
|
|
|
# don't blunder into a user-defined symbolic link.
|
|
|
|
GOPATH=$GOROOT/nonexistentpath
|
|
|
|
export GOPATH
|
|
|
|
|
2010-03-31 20:48:33 -06:00
|
|
|
unset CDPATH # in case user has it set
|
2016-05-19 11:43:04 -06:00
|
|
|
unset GOBIN # Issue 14340
|
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.
|
2018-04-01 10:01:52 -06:00
|
|
|
# See longer discussion on golang.org/issue/7381.
|
2017-03-10 10:15:46 -07:00
|
|
|
[ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n)
|
|
|
|
[ "$(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
|
2017-03-10 10:15:46 -07:00
|
|
|
[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
|
2013-06-17 03:31:58 -06:00
|
|
|
fi
|
|
|
|
|
2015-12-20 12:29:20 -07:00
|
|
|
exec go tool dist test -rebuild "$@"
|