github.com/zach-klippenstein/go@v0.0.0-20150108044943-fcfbeb3adf58/src/run.bat (about)

     1  :: Copyright 2012 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  @echo off
     5  
     6  :: Keep environment variables within this script
     7  :: unless invoked with --no-local.
     8  if x%1==x--no-local goto nolocal
     9  if x%2==x--no-local goto nolocal
    10  setlocal
    11  :nolocal
    12  
    13  set GOBUILDFAIL=0
    14  
    15  :: we disallow local import for non-local packages, if %GOROOT% happens
    16  :: to be under %GOPATH%, then some tests below will fail
    17  set GOPATH=
    18  
    19  rem TODO avoid rebuild if possible
    20  
    21  if x%1==x--no-rebuild goto norebuild
    22  echo ##### Building packages and commands.
    23  go install -a -v std
    24  if errorlevel 1 goto fail
    25  echo.
    26  :norebuild
    27  
    28  :: we must unset GOROOT_FINAL before tests, because runtime/debug requires
    29  :: correct access to source code, so if we have GOROOT_FINAL in effect,
    30  :: at least runtime/debug test will fail.
    31  set GOROOT_FINAL=
    32  
    33  :: get CGO_ENABLED
    34  go env > env.bat
    35  if errorlevel 1 goto fail
    36  call env.bat
    37  del env.bat
    38  echo.
    39  
    40  echo ##### Testing packages.
    41  go test std -short -timeout=120s
    42  if errorlevel 1 goto fail
    43  echo.
    44  
    45  set OLDGOMAXPROCS=%GOMAXPROCS%
    46  
    47  :: We set GOMAXPROCS=2 in addition to -cpu=1,2,4 in order to test runtime bootstrap code,
    48  :: creation of first goroutines and first garbage collections in the parallel setting.
    49  echo ##### GOMAXPROCS=2 runtime -cpu=1,2,4
    50  set GOMAXPROCS=2
    51  go test runtime -short -timeout=300s -cpu=1,2,4
    52  if errorlevel 1 goto fail
    53  echo.
    54  
    55  set GOMAXPROCS=%OLDGOMAXPROCS%
    56  set OLDGOMAXPROCS=
    57  
    58  echo ##### sync -cpu=10
    59  go test sync -short -timeout=120s -cpu=10
    60  if errorlevel 1 goto fail
    61  echo.
    62  
    63  :: Race detector only supported on Linux and OS X,
    64  :: and only on amd64, and only when cgo is enabled.
    65  if not "%GOHOSTOS%-%GOOS%-%GOARCH%-%CGO_ENABLED%" == "windows-windows-amd64-1" goto norace
    66  echo ##### Testing race detector.
    67  go test -race -i runtime/race flag
    68  if errorlevel 1 goto fail
    69  go test -race -run=Output runtime/race
    70  if errorlevel 1 goto fail
    71  go test -race -short flag
    72  if errorlevel 1 goto fail
    73  echo.
    74  :norace
    75  
    76  echo ##### ..\test\bench\go1
    77  go test ..\test\bench\go1
    78  if errorlevel 1 goto fail
    79  echo.
    80  
    81  :: cgo tests
    82  if x%CGO_ENABLED% == x0 goto nocgo
    83  echo ##### ..\misc\cgo\life
    84  go run "%GOROOT%\test\run.go" - ..\misc\cgo\life
    85  if errorlevel 1 goto fail
    86  echo.
    87  
    88  echo ##### ..\misc\cgo\stdio
    89  go run "%GOROOT%\test\run.go" - ..\misc\cgo\stdio
    90  if errorlevel 1 goto fail
    91  echo.
    92  
    93  :: cgo tests inspect the traceback for runtime functions
    94  set OLDGOTRACEBACK=%GOTRACEBACK%
    95  set GOTRACEBACK=2
    96  
    97  echo ##### ..\misc\cgo\test
    98  go test ..\misc\cgo\test
    99  if errorlevel 1 goto fail
   100  echo.
   101  
   102  set GOTRACEBACK=%OLDGOTRACEBACK%
   103  set OLDGOTRACEBACK=
   104  
   105  echo ##### ..\misc\cgo\testso
   106  cd ..\misc\cgo\testso
   107  set FAIL=0
   108  call test.bat
   109  cd ..\..\..\src
   110  if %FAIL%==1 goto fail
   111  echo.
   112  :nocgo
   113  
   114  echo ##### ..\doc\progs
   115  go run "%GOROOT%\test\run.go" - ..\doc\progs
   116  if errorlevel 1 goto fail
   117  echo.
   118  
   119  :: TODO: The other tests in run.bash.
   120  
   121  
   122  set OLDGOMAXPROCS=%GOMAXPROCS%
   123  
   124  echo ##### ..\test
   125  cd ..\test
   126  set FAIL=0
   127  set GOMAXPROCS=
   128  go run run.go
   129  if errorlevel 1 set FAIL=1
   130  cd ..\src
   131  echo.
   132  if %FAIL%==1 goto fail
   133  
   134  set GOMAXPROCS=%OLDGOMAXPROCS%
   135  set OLDGOMAXPROCS=
   136  
   137  :: echo ##### Checking API compatibility.
   138  go run "%GOROOT%\src\cmd\api\run.go"
   139  if errorlevel 1 goto fail
   140  echo.
   141  
   142  echo ALL TESTS PASSED
   143  goto end
   144  
   145  :fail
   146  set GOBUILDFAIL=1
   147  
   148  :end