github.com/reiver/go@v0.0.0-20150109200633-1d0c7792f172/src/race.bash (about) 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 # http://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, freebsd/amd64 and darwin/amd64' 1>&2 13 exit 1 14 } 15 16 case $(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 "FreeBSD") 29 if [ $(uname -m) != "amd64" ]; then 30 usage 31 fi 32 ;; 33 *) 34 usage 35 ;; 36 esac 37 38 if [ ! -f make.bash ]; then 39 echo 'race.bash must be run from $GOROOT/src' 1>&2 40 exit 1 41 fi 42 . ./make.bash --no-banner 43 # golang.org/issue/5537 - we must build a race enabled cmd/cgo before trying to use it. 44 go install -race cmd/cgo 45 go install -race std 46 47 # we must unset GOROOT_FINAL before tests, because runtime/debug requires 48 # correct access to source code, so if we have GOROOT_FINAL in effect, 49 # at least runtime/debug test will fail. 50 unset GOROOT_FINAL 51 52 go test -race -short std 53 go test -race -run=nothingplease -bench=.* -benchtime=.1s -cpu=4 std