Black Lives Matter. Support the Equal Justice Initiative.

Text file src/race.bash

Documentation: Index

     1  #!/usr/bin/env bash
     2  # Copyright 2013 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  # race.bash tests the standard library under the race detector.
     7  # https://golang.org/doc/articles/race_detector.html
     8  
     9  set -e
    10  
    11  function usage {
    12  	echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
    13  	exit 1
    14  }
    15  
    16  case $(uname) in
    17  "Darwin")
    18  	if [ $(uname -m) != "x86_64" ] && [ $(uname -m) != "arm64" ]; then
    19  		usage
    20  	fi
    21  	;;
    22  "Linux")
    23  	if [ $(uname -m) != "x86_64" ] && [ $(uname -m) != "ppc64le" ] && [ $(uname -m) != "aarch64" ]; then
    24  		usage
    25  	fi
    26  	;;
    27  "FreeBSD")
    28  	if [ $(uname -m) != "amd64" ]; then
    29  		usage
    30  	fi
    31  	;;
    32  "NetBSD")
    33  	if [ $(uname -m) != "amd64" ]; then
    34  		usage
    35  	fi
    36  	;;
    37  "OpenBSD")
    38  	if [ $(uname -m) != "amd64" ]; then
    39  		usage
    40  	fi
    41  	;;
    42  *)
    43  	usage
    44  	;;
    45  esac
    46  
    47  if [ ! -f make.bash ]; then
    48  	echo 'race.bash must be run from $GOROOT/src' 1>&2
    49  	exit 1
    50  fi
    51  . ./make.bash --no-banner
    52  go install -race std
    53  go tool dist test -race
    54  

View as plain text