blob: 18201f992ce1127a1031260618b31fdc9a630ba9 [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.
7# http://golang.org/doc/articles/race_detector.html
8
9set -e
10
11function usage {
12 echo 'race detector is only supported on linux/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" ]; then
25 usage
26 fi
27 ;;
28*)
29 usage
30 ;;
31esac
32
33if [ ! -f make.bash ]; then
34 echo 'race.bash must be run from $GOROOT/src' 1>&2
35 exit 1
36fi
37. ./make.bash --no-banner
Dave Cheneycdb33232013-09-29 10:34:41 +100038# golang.org/issue/5537 - we must build a race enabled cmd/cgo before trying to use it.
39go install -race cmd/cgo
Dave Cheneyb53e95a2013-01-28 21:05:25 +110040go install -race std
41go test -race -short std
42go test -race -run=nothingplease -bench=.* -benchtime=.1s -cpu=4 std