]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime/race: add Windows support
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 7 Nov 2012 19:59:09 +0000 (23:59 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 7 Nov 2012 19:59:09 +0000 (23:59 +0400)
This is copy of https://golang.org/cl/6810080
but sent from another account (dvyukov@gmail.com is not in CONTRIBUTORS).

R=rsc
CC=golang-dev
https://golang.org/cl/6827060

src/cmd/go/build.go
src/pkg/runtime/race/race.go
src/pkg/runtime/race/race_windows_amd64.syso [new file with mode: 0644]
src/run.bat

index 4cfecdd88f19512a5b13be5a02b04e5b2ce4e48c..1b5b7f4498de8c399ba1503323419030d89a446f 100644 (file)
@@ -1840,8 +1840,8 @@ func raceInit() {
        if !buildRace {
                return
        }
-       if goarch != "amd64" || goos != "linux" && goos != "darwin" {
-               fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/amd64 and darwin/amd64\n", flag.Args()[0])
+       if goarch != "amd64" || goos != "linux" && goos != "darwin" && goos != "windows" {
+               fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/amd64, darwin/amd64 and windows/amd64\n", flag.Args()[0])
                os.Exit(2)
        }
        buildGcflags = append(buildGcflags, "-b")
index fb59ee833846550328d36b8c489d166cef7432a4..b5f402ef3864a9e40ddb97adea97e63d11f4b948 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build race,linux,amd64 race,darwin,amd64
+// +build race,linux,amd64 race,darwin,amd64 race,windows,amd64
 
 // Package race provides low-level facilities for data race detection.
 package race
diff --git a/src/pkg/runtime/race/race_windows_amd64.syso b/src/pkg/runtime/race/race_windows_amd64.syso
new file mode 100644 (file)
index 0000000..9aecde4
Binary files /dev/null and b/src/pkg/runtime/race/race_windows_amd64.syso differ
index 78c9858be50f49f6483a0fb1a7462b014f469744..275107bf5349749d87e2e4925d60aa47f6b560a8 100644 (file)
@@ -52,6 +52,15 @@ go test sync -short -timeout=120s -cpu=10
 if errorlevel 1 goto fail
 echo.
 
+if not "%GOHOSTOS%-%GOOS%-%GOARCH%-%CGO_ENABLED%" == "windows-windows-amd64-1" goto norace
+echo # Testing race detector.
+go test -race -i flag
+if errorlevel 1 goto fail
+go test -race -short flag
+if errorlevel 1 goto fail
+echo.
+:norace
+
 echo # ..\misc\dashboard\builder ..\misc\goplay
 go build ..\misc\dashboard\builder ..\misc\goplay
 if errorlevel 1 goto fail