blob: 6fc864dc0ea0f7d2a09c3ac41fa9954893d1fbc8 [file] [log] [blame]
Devon H. O'Dell553be842009-11-14 15:29:09 -08001#!/usr/bin/env bash
Russ Coxbbb00c62008-10-08 09:46:54 -07002# 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
6set -e
7
Shenghou Ma6d4da062012-03-10 03:42:23 +08008eval $(go env)
Shenghou Ma6f3f2d02014-04-29 14:43:10 -04009export GOROOT # the api test requires GOROOT to be set.
Russ Cox82905362012-02-04 00:54:08 -050010
Russ Cox69fd2a42010-03-31 19:48:33 -070011unset CDPATH # in case user has it set
Shenghou Ma23322ab2012-03-21 00:47:27 +080012unset 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'Dell857d4cf2009-12-11 15:14:09 -080014
Brad Fitzpatrickd5f69062015-03-02 17:07:11 -080015export GOHOSTOS
16export CC
17
Russ Coxda776792009-11-09 23:11:36 -080018# no core files, please
19ulimit -c 0
20
Shenghou Ma329b27a2012-09-17 01:11:28 +080021# 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 Coxe6e89452014-02-24 16:44:35 -050024#
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 Ma329b27a2012-09-17 01:11:28 +080030[ "$(ulimit -H -n)" == "unlimited" ] || ulimit -S -n $(ulimit -H -n)
Shenghou Maa1a414e2012-09-17 01:26:57 +080031[ "$(ulimit -H -d)" == "unlimited" ] || ulimit -S -d $(ulimit -H -d)
Shenghou Ma329b27a2012-09-17 01:11:28 +080032
Benny Siegert8a4efed2013-06-17 19:31:58 +100033# Thread count limit on NetBSD 7.
34if ulimit -T &> /dev/null; then
35 [ "$(ulimit -H -T)" == "unlimited" ] || ulimit -S -T $(ulimit -H -T)
36fi
37
Brad Fitzpatrickd5f69062015-03-02 17:07:11 -080038exec go tool dist test $@