blob: 33db692878f8a79d0a2b85e7797e271d3c1c7b6b [file] [log] [blame]
Shenghou Ma8047e8e2013-02-03 00:49:37 +08001:: 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 Fitzpatrick2ae77372015-07-10 17:17:11 -06006:: https://golang.org/doc/articles/race_detector.html
Shenghou Ma8047e8e2013-02-03 00:49:37 +08007
8@echo off
9
10setlocal
11
12if exist make.bat goto ok
13echo race.bat must be run from go\src
14:: cannot exit: would kill parent command interpreter
15goto end
16:ok
17
Dmitriy Vyukov830f9ac2013-12-17 12:59:13 +040018set GOROOT=%CD%\..
Shenghou Ma8047e8e2013-02-03 00:49:37 +080019call make.bat --dist-tool >NUL
20if errorlevel 1 goto fail
Brad Fitzpatrickac90d9a2015-02-06 17:52:24 -080021.\cmd\dist\dist env -w -p >env.bat
Shenghou Ma8047e8e2013-02-03 00:49:37 +080022if errorlevel 1 goto fail
23call env.bat
24del env.bat
25
26if %GOHOSTARCH% == amd64 goto continue
27echo Race detector is only supported on windows/amd64.
28goto fail
29
30:continue
31call make.bat --no-banner --no-local
32if %GOBUILDFAIL%==1 goto end
Shenghou Ma8047e8e2013-02-03 00:49:37 +080033echo # go install -race std
34go install -race std
35if errorlevel 1 goto fail
Alex Brainman5d251892014-05-07 16:34:21 +100036
Brad Fitzpatrick10425502015-06-08 17:56:27 -070037go tool dist test -no-rebuild -race
Alex Brainman5d251892014-05-07 16:34:21 +100038
Shenghou Ma8047e8e2013-02-03 00:49:37 +080039if errorlevel 1 goto fail
40goto succ
41
42:fail
43set GOBUILDFAIL=1
44echo Fail.
45goto end
46
47:succ
48echo All tests passed.
49
50:end
Dmitriy Vyukovd24019f2013-12-17 15:09:42 +040051if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%
Shenghou Ma8047e8e2013-02-03 00:49:37 +080052