Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 1 | :: Copyright 2013 The Go Authors. All rights reserved. |
| 2 | :: Use of this source code is governed by a BSD-style |
| 3 | :: license that can be found in the LICENSE file. |
| 4 | |
| 5 | :: race.bash tests the standard library under the race detector. |
Brad Fitzpatrick | 2ae7737 | 2015-07-10 17:17:11 -0600 | [diff] [blame] | 6 | :: https://golang.org/doc/articles/race_detector.html |
Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 7 | |
| 8 | @echo off |
| 9 | |
| 10 | setlocal |
| 11 | |
| 12 | if exist make.bat goto ok |
| 13 | echo race.bat must be run from go\src |
| 14 | :: cannot exit: would kill parent command interpreter |
| 15 | goto end |
| 16 | :ok |
| 17 | |
Dmitriy Vyukov | 830f9ac | 2013-12-17 12:59:13 +0400 | [diff] [blame] | 18 | set GOROOT=%CD%\.. |
Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 19 | call make.bat --dist-tool >NUL |
| 20 | if errorlevel 1 goto fail |
Brad Fitzpatrick | ac90d9a | 2015-02-06 17:52:24 -0800 | [diff] [blame] | 21 | .\cmd\dist\dist env -w -p >env.bat |
Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 22 | if errorlevel 1 goto fail |
| 23 | call env.bat |
| 24 | del env.bat |
| 25 | |
| 26 | if %GOHOSTARCH% == amd64 goto continue |
| 27 | echo Race detector is only supported on windows/amd64. |
| 28 | goto fail |
| 29 | |
| 30 | :continue |
| 31 | call make.bat --no-banner --no-local |
| 32 | if %GOBUILDFAIL%==1 goto end |
Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 33 | echo # go install -race std |
| 34 | go install -race std |
| 35 | if errorlevel 1 goto fail |
Alex Brainman | 5d25189 | 2014-05-07 16:34:21 +1000 | [diff] [blame] | 36 | |
Brad Fitzpatrick | 1042550 | 2015-06-08 17:56:27 -0700 | [diff] [blame] | 37 | go tool dist test -no-rebuild -race |
Alex Brainman | 5d25189 | 2014-05-07 16:34:21 +1000 | [diff] [blame] | 38 | |
Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 39 | if errorlevel 1 goto fail |
| 40 | goto succ |
| 41 | |
| 42 | :fail |
| 43 | set GOBUILDFAIL=1 |
| 44 | echo Fail. |
| 45 | goto end |
| 46 | |
| 47 | :succ |
| 48 | echo All tests passed. |
| 49 | |
| 50 | :end |
Dmitriy Vyukov | d24019f | 2013-12-17 15:09:42 +0400 | [diff] [blame] | 51 | if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL% |
Shenghou Ma | 8047e8e | 2013-02-03 00:49:37 +0800 | [diff] [blame] | 52 | |