github.com/ader1990/go@v0.0.0-20140630135419-8c24447fa791/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  echo # ..\misc\cgo\test
    94  go test ..\misc\cgo\test
    95  if errorlevel 1 goto fail
    96  echo.
    97  
    98  echo # ..\misc\cgo\testso
    99  cd ..\misc\cgo\testso
   100  set FAIL=0
   101  call test.bat
   102  cd ..\..\..\src
   103  if %FAIL%==1 goto fail
   104  echo.
   105  :nocgo
   106  
   107  echo # ..\doc\progs
   108  go run "%GOROOT%\test\run.go" - ..\doc\progs
   109  if errorlevel 1 goto fail
   110  echo.
   111  
   112  :: TODO: The other tests in run.bash.
   113  
   114  
   115  set OLDGOMAXPROCS=%GOMAXPROCS%
   116  
   117  echo # ..\test
   118  cd ..\test
   119  set FAIL=0
   120  set GOMAXPROCS=
   121  go run run.go
   122  if errorlevel 1 set FAIL=1
   123  cd ..\src
   124  echo.
   125  if %FAIL%==1 goto fail
   126  
   127  set GOMAXPROCS=%OLDGOMAXPROCS%
   128  set OLDGOMAXPROCS=
   129  
   130  echo # Checking API compatibility.
   131  go run "%GOROOT%\src\cmd\api\run.go"
   132  if errorlevel 1 goto fail
   133  echo.
   134  
   135  echo ALL TESTS PASSED
   136  goto end
   137  
   138  :fail
   139  set GOBUILDFAIL=1
   140  
   141  :end