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, linux/s390x, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
13	exit 1
14}
15
16case $(uname -s -m) in
17  "Darwin x86_64") ;;
18  "Darwin arm64")  ;;
19  "Linux x86_64")  ;;
20  "Linux ppc64le") ;;
21  "Linux aarch64") ;;
22  "Linux s390x")   ;;
23  "FreeBSD amd64") ;;
24  "NetBSD amd64")  ;;
25  "OpenBSD amd64") ;;
26  *) usage         ;;
27esac
28
29if [ ! -f make.bash ]; then
30	echo 'race.bash must be run from $GOROOT/src' 1>&2
31	exit 1
32fi
33. ./make.bash --no-banner
34go install -race std
35go tool dist test -race
36