Text file src/run.bash

Documentation: Index

     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# Environment variables that control run.bash:
     7#
     8# GO_TEST_SHARDS: number of "dist test" test shards that the
     9# $GOROOT/test directory will be sliced up into for parallel
    10# execution. Defaults to 1, unless GO_BUILDER_NAME is also specified,
    11# in which case it defaults to 10.
    12#
    13# GO_BUILDER_NAME: the name of the Go builder that's running the tests.
    14# Some tests are conditionally enabled or disabled based on the builder
    15# name or the builder name being non-empty.
    16
    17set -e
    18
    19eval $(go env)
    20export GOROOT   # the api test requires GOROOT to be set.
    21
    22# We disallow local import for non-local packages, if $GOROOT happens
    23# to be under $GOPATH, then some tests below will fail.  $GOPATH needs
    24# to be set to a non-empty string, else Go will set a default value
    25# that may also conflict with $GOROOT.  The $GOPATH value doesn't need
    26# to point to an actual directory, it just needs to pass the semantic
    27# checks performed by Go.  Use $GOROOT to define $GOPATH so that we
    28# don't blunder into a user-defined symbolic link.
    29export GOPATH=/dev/null
    30
    31unset CDPATH	# in case user has it set
    32export GOBIN=$GOROOT/bin  # Issue 14340
    33unset GOFLAGS
    34unset GO111MODULE
    35
    36export GOHOSTOS
    37export CC
    38
    39# no core files, please
    40ulimit -c 0
    41
    42# Raise soft limits to hard limits for NetBSD/OpenBSD.
    43# We need at least 256 files and ~300 MB of bss.
    44# On OS X ulimit -S -n rejects 'unlimited'.
    45#
    46# Note that ulimit -S -n may fail if ulimit -H -n is set higher than a
    47# non-root process is allowed to set the high limit.
    48# This is a system misconfiguration and should be fixed on the
    49# broken system, not "fixed" by ignoring the failure here.
    50# See longer discussion on golang.org/issue/7381.
    51[ "$(ulimit -H -n)" = "unlimited" ] || ulimit -S -n $(ulimit -H -n)
    52[ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d)
    53
    54# Thread count limit on NetBSD 7.
    55if ulimit -T &> /dev/null; then
    56	[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
    57fi
    58
    59exec go tool dist test -rebuild "$@"

View as plain text