1
0
mirror of https://github.com/golang/go synced 2024-11-23 09:00:04 -07:00
go/src/race.bash
Joel Sing b3b65f2176 runtime: enable race detector on openbsd/amd64
Now that this commit[1] has landed in LLVM the .syso file can be generated for
OpenBSD.

With the changes to src/runtime running the sample race[2] detects the data
race as expected.

Based on golang/go#39464 (https://go-review.googlesource.com/c/go/+/237057) from
Aaron Bieber <deftly@gmail.com>, however the race_openbsd_amd64.syso file has
been built on OpenBSD 6.4 and necessary changes added to race.bash.

[1] fcf6ae2f07
[2] https://golang.org/doc/articles/race_detector.html

Change-Id: Ic2479ccfa91d6b2cb4585346a11d813d96450f68
Reviewed-on: https://go-review.googlesource.com/c/go/+/275892
Trust: Joel Sing <joel@sing.id.au>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-02-23 12:14:32 +00:00

54 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2013 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# race.bash tests the standard library under the race detector.
# https://golang.org/doc/articles/race_detector.html
set -e
function usage {
echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
exit 1
}
case $(uname) in
"Darwin")
if [ $(uname -m) != "x86_64" ] && [ $(uname -m) != "arm64" ]; then
usage
fi
;;
"Linux")
if [ $(uname -m) != "x86_64" ] && [ $(uname -m) != "ppc64le" ] && [ $(uname -m) != "aarch64" ]; then
usage
fi
;;
"FreeBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
"NetBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
"OpenBSD")
if [ $(uname -m) != "amd64" ]; then
usage
fi
;;
*)
usage
;;
esac
if [ ! -f make.bash ]; then
echo 'race.bash must be run from $GOROOT/src' 1>&2
exit 1
fi
. ./make.bash --no-banner
go install -race std
go tool dist test -race