Text file src/run.bash

     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  #
    17  # GO_TEST_SHORT: if set to a non-empty, false-ish string, run tests in "-short=false" mode.
    18  # This environment variable is an internal implementation detail between the
    19  # Go build system (x/build) and cmd/dist for the purpose of longtest builders,
    20  # and will be removed if it stops being needed. See go.dev/issue/12508.
    21  #
    22  # GO_TEST_TIMEOUT_SCALE: a non-negative integer factor to scale test timeout by.
    23  # Defaults to 1.
    24  #
    25  # GO_TEST_ASMFLAGS: Additional go tool asm arguments to use when running the tests.
    26  # This environment variable is an internal implementation detail between the
    27  # Go build system (x/build) and cmd/dist to enable builders that need to control this,
    28  # and will be removed if it stops being needed, or if a more general-purpose
    29  # GO_ASMFLAGS environment variable gets added to make.bash and supersedes this
    30  # test-only subset of it. See go.dev/issue/77427.
    31  
    32  set -e
    33  
    34  if [ ! -f ../bin/go ]; then
    35  	echo 'run.bash must be run from $GOROOT/src after installing cmd/go' 1>&2
    36  	exit 1
    37  fi
    38  
    39  export GOENV=off
    40  eval $(../bin/go tool dist env)
    41  
    42  unset CDPATH	# in case user has it set
    43  
    44  export GOHOSTOS
    45  export CC
    46  
    47  # no core files, please
    48  ulimit -c 0
    49  
    50  # Raise soft limits to hard limits for NetBSD/OpenBSD.
    51  # We need at least ~300 MB of bss.
    52  [ "$(ulimit -H -d)" = "unlimited" ] || ulimit -S -d $(ulimit -H -d)
    53  
    54  # Thread count limit on NetBSD 7.
    55  if ulimit -T &> /dev/null; then
    56  	[ "$(ulimit -H -T)" = "unlimited" ] || ulimit -S -T $(ulimit -H -T)
    57  fi
    58  
    59  export GOPATH=/nonexist-gopath
    60  exec ../bin/go tool dist test -rebuild "$@"
    61  

View as plain text