github.com/spotify/syslog-redirector-golang@v0.0.0-20140320174030-4859f03d829a/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  echo # runtime -cpu=1,2,4
    46  go test runtime -short -timeout=300s -cpu=1,2,4
    47  if errorlevel 1 goto fail
    48  echo.
    49  
    50  echo # sync -cpu=10
    51  go test sync -short -timeout=120s -cpu=10
    52  if errorlevel 1 goto fail
    53  echo.
    54  
    55  if not "%GOHOSTOS%-%GOOS%-%GOARCH%-%CGO_ENABLED%" == "windows-windows-amd64-1" goto norace
    56  echo # Testing race detector.
    57  go test -race -i runtime/race flag
    58  if errorlevel 1 goto fail
    59  go test -race -run=Output runtime/race
    60  if errorlevel 1 goto fail
    61  go test -race -short flag
    62  if errorlevel 1 goto fail
    63  echo.
    64  :norace
    65  
    66  echo # ..\misc\goplay
    67  go build ..\misc\goplay
    68  if errorlevel 1 goto fail
    69  echo.
    70  
    71  echo # ..\test\bench\go1
    72  go test ..\test\bench\go1
    73  if errorlevel 1 goto fail
    74  echo.
    75  
    76  :: cgo tests
    77  if x%CGO_ENABLED% == x0 goto nocgo
    78  echo # ..\misc\cgo\life
    79  go run "%GOROOT%\test\run.go" - ..\misc\cgo\life
    80  if errorlevel 1 goto fail
    81  echo.
    82  
    83  echo # ..\misc\cgo\stdio
    84  go run "%GOROOT%\test\run.go" - ..\misc\cgo\stdio
    85  if errorlevel 1 goto fail
    86  echo.
    87  
    88  echo # ..\misc\cgo\test
    89  go test ..\misc\cgo\test
    90  if errorlevel 1 goto fail
    91  echo.
    92  
    93  echo # ..\misc\cgo\testso
    94  cd ..\misc\cgo\testso
    95  set FAIL=0
    96  call test.bat
    97  cd ..\..\..\src
    98  if %FAIL%==1 goto fail
    99  echo.
   100  :nocgo
   101  
   102  echo # ..\doc\progs
   103  go run "%GOROOT%\test\run.go" - ..\doc\progs
   104  if errorlevel 1 goto fail
   105  echo.
   106  
   107  :: TODO: The other tests in run.bash.
   108  
   109  
   110  set OLDGOMAXPROCS=%GOMAXPROCS%
   111  
   112  echo # ..\test
   113  cd ..\test
   114  set FAIL=0
   115  set GOMAXPROCS=
   116  go run run.go
   117  if errorlevel 1 set FAIL=1
   118  cd ..\src
   119  echo.
   120  if %FAIL%==1 goto fail
   121  
   122  set GOMAXPROCS=%OLDGOMAXPROCS%
   123  set OLDGOMAXPROCS=
   124  
   125  echo # Checking API compatibility.
   126  go run "%GOROOT%\src\cmd\api\run.go"
   127  if errorlevel 1 goto fail
   128  echo.
   129  
   130  echo ALL TESTS PASSED
   131  goto end
   132  
   133  :fail
   134  set GOBUILDFAIL=1
   135  
   136  :end