blob: e0917369f393f37ae3eee550e10fdddc1f6b3975 [file] [log] [blame]
Dave Cheneyb53e95a2013-01-28 21:05:25 +11001#!/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.
Brad Fitzpatrick2ae77372015-07-10 17:17:11 -06007# https://golang.org/doc/articles/race_detector.html
Dave Cheneyb53e95a2013-01-28 21:05:25 +11008
9set -e
10
11function usage {
Dmitriy Vyukovde2feea2014-06-24 15:47:22 -070012 echo 'race detector is only supported on linux/amd64, freebsd/amd64 and darwin/amd64' 1>&2
Dave Cheneyb53e95a2013-01-28 21:05:25 +110013 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" ]; then
25 usage
26 fi
27 ;;
Dmitriy Vyukovde2feea2014-06-24 15:47:22 -070028"FreeBSD")
29 if [ $(uname -m) != "amd64" ]; then
30 usage
31 fi
32 ;;
Dave Cheneyb53e95a2013-01-28 21:05:25 +110033*)
34 usage
35 ;;
36esac
37
38if [ ! -f make.bash ]; then
39 echo 'race.bash must be run from $GOROOT/src' 1>&2
40 exit 1
41fi
42. ./make.bash --no-banner
Dave Cheneyb53e95a2013-01-28 21:05:25 +110043go install -race std
Brad Fitzpatrick10425502015-06-08 17:56:27 -070044go tool dist test -no-rebuild -race