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
     9set -e
    10
    11function usage {
    12	echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64 and darwin/amd64' 1>&2
    13	exit 1
    14}
    15
    16case $(uname) in
    17"Darwin")
    18	# why Apple? why?
    19	if sysctl machdep.cpu.extfeatures | grep -qv EM64T; then
    20		usage
    21	fi
    22	;;
    23"Linux")
    24	if [ $(uname -m) != "x86_64" ] && [ $(uname -m) != "ppc64le" ] && [ $(uname -m) != "aarch64" ]; then
    25		usage
    26	fi
    27	;;
    28"FreeBSD")
    29	if [ $(uname -m) != "amd64" ]; then
    30		usage
    31	fi
    32	;;
    33"NetBSD")
    34	if [ $(uname -m) != "amd64" ]; then
    35		usage
    36	fi
    37	;;
    38*)
    39	usage
    40	;;
    41esac
    42
    43if [ ! -f make.bash ]; then
    44	echo 'race.bash must be run from $GOROOT/src' 1>&2
    45	exit 1
    46fi
    47. ./make.bash --no-banner
    48go install -race std
    49go tool dist test -race

View as plain text