2012-02-03 22:48:31 -07:00
|
|
|
:: Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
:: Use of this source code is governed by a BSD-style
|
|
|
|
:: license that can be found in the LICENSE file.
|
|
|
|
@echo off
|
|
|
|
|
2012-02-15 16:44:55 -07:00
|
|
|
:: Keep environment variables within this script
|
|
|
|
:: unless invoked with --no-local.
|
|
|
|
if x%1==x--no-local goto nolocal
|
|
|
|
if x%2==x--no-local goto nolocal
|
|
|
|
setlocal
|
|
|
|
:nolocal
|
|
|
|
|
2012-02-03 22:48:31 -07:00
|
|
|
set GOBUILDFAIL=0
|
|
|
|
|
2012-03-20 10:47:27 -06:00
|
|
|
:: we disallow local import for non-local packages, if %GOROOT% happens
|
|
|
|
:: to be under %GOPATH%, then some tests below will fail
|
|
|
|
set GOPATH=
|
|
|
|
|
2012-02-03 22:48:31 -07:00
|
|
|
rem TODO avoid rebuild if possible
|
|
|
|
|
|
|
|
if x%1==x--no-rebuild goto norebuild
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### Building packages and commands.
|
2015-02-22 10:41:32 -07:00
|
|
|
go install -a -v std cmd
|
2012-02-03 22:48:31 -07:00
|
|
|
if errorlevel 1 goto fail
|
2012-02-16 13:49:50 -07:00
|
|
|
echo.
|
2012-02-03 22:48:31 -07:00
|
|
|
:norebuild
|
|
|
|
|
2012-04-04 09:14:54 -06:00
|
|
|
:: we must unset GOROOT_FINAL before tests, because runtime/debug requires
|
|
|
|
:: correct access to source code, so if we have GOROOT_FINAL in effect,
|
|
|
|
:: at least runtime/debug test will fail.
|
|
|
|
set GOROOT_FINAL=
|
|
|
|
|
2012-08-06 19:38:35 -06:00
|
|
|
:: get CGO_ENABLED
|
|
|
|
go env > env.bat
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
call env.bat
|
|
|
|
del env.bat
|
|
|
|
echo.
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### Testing packages.
|
2015-02-22 10:41:32 -07:00
|
|
|
go test std cmd -short -timeout=120s
|
2012-02-03 22:48:31 -07:00
|
|
|
if errorlevel 1 goto fail
|
2012-02-16 13:49:50 -07:00
|
|
|
echo.
|
2012-02-03 22:48:31 -07:00
|
|
|
|
2014-03-06 02:16:14 -07:00
|
|
|
set OLDGOMAXPROCS=%GOMAXPROCS%
|
|
|
|
|
|
|
|
:: We set GOMAXPROCS=2 in addition to -cpu=1,2,4 in order to test runtime bootstrap code,
|
|
|
|
:: creation of first goroutines and first garbage collections in the parallel setting.
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### GOMAXPROCS=2 runtime -cpu=1,2,4
|
2014-03-06 02:16:14 -07:00
|
|
|
set GOMAXPROCS=2
|
2013-07-11 20:30:18 -06:00
|
|
|
go test runtime -short -timeout=300s -cpu=1,2,4
|
2012-02-03 22:48:31 -07:00
|
|
|
if errorlevel 1 goto fail
|
2012-02-16 13:49:50 -07:00
|
|
|
echo.
|
2012-02-03 22:48:31 -07:00
|
|
|
|
2014-03-06 02:16:14 -07:00
|
|
|
set GOMAXPROCS=%OLDGOMAXPROCS%
|
|
|
|
set OLDGOMAXPROCS=
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### sync -cpu=10
|
2012-02-03 22:48:31 -07:00
|
|
|
go test sync -short -timeout=120s -cpu=10
|
|
|
|
if errorlevel 1 goto fail
|
2012-02-16 13:49:50 -07:00
|
|
|
echo.
|
2012-02-03 22:48:31 -07:00
|
|
|
|
2014-02-17 22:48:34 -07:00
|
|
|
:: Race detector only supported on Linux and OS X,
|
|
|
|
:: and only on amd64, and only when cgo is enabled.
|
2014-02-19 00:19:27 -07:00
|
|
|
if not "%GOHOSTOS%-%GOOS%-%GOARCH%-%CGO_ENABLED%" == "windows-windows-amd64-1" goto norace
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### Testing race detector.
|
2013-08-14 20:13:00 -06:00
|
|
|
go test -race -i runtime/race flag
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
go test -race -run=Output runtime/race
|
2012-11-07 12:59:09 -07:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
go test -race -short flag
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
echo.
|
|
|
|
:norace
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\test\bench\go1
|
2012-09-18 20:07:25 -06:00
|
|
|
go test ..\test\bench\go1
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
echo.
|
2012-03-19 21:04:20 -06:00
|
|
|
|
2012-08-06 19:38:35 -06:00
|
|
|
:: cgo tests
|
|
|
|
if x%CGO_ENABLED% == x0 goto nocgo
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\misc\cgo\life
|
2013-03-24 19:13:34 -06:00
|
|
|
go run "%GOROOT%\test\run.go" - ..\misc\cgo\life
|
2012-09-26 08:34:25 -06:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
echo.
|
cmd/go: new cgo build procedure
This CL adds a step to the build procedure for cgo programs. It uses 'ld -r'
to combine all gcc compiled object file and generate a relocatable object file
for our ld. Additionally, this linking step will combine some static linking
gcc library into the relocatable object file, so that we can use libgcc,
libmingwex and libmingw32 without problem.
Fixes #3261.
Fixes #1741.
Added a testcase for linking in libgcc.
TODO:
1. still need to fix the INDIRECT_SYMBOL_LOCAL problem on Darwin/386.
2. still need to enable the libgcc test on Linux/ARM, because 5l can't deal
with thumb libgcc.
Tested on Darwin/amd64, Darwin/386, FreeBSD/amd64, FreeBSD/386, Linux/amd64,
Linux/386, Linux/ARM, Windows/amd64, Windows/386
R=iant, rsc, bradfitz, coldredlemur
CC=golang-dev
https://golang.org/cl/5822049
2012-08-16 13:42:34 -06:00
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\misc\cgo\stdio
|
2013-03-24 19:13:34 -06:00
|
|
|
go run "%GOROOT%\test\run.go" - ..\misc\cgo\stdio
|
2012-09-19 10:27:23 -06:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
echo.
|
cmd/go: new cgo build procedure
This CL adds a step to the build procedure for cgo programs. It uses 'ld -r'
to combine all gcc compiled object file and generate a relocatable object file
for our ld. Additionally, this linking step will combine some static linking
gcc library into the relocatable object file, so that we can use libgcc,
libmingwex and libmingw32 without problem.
Fixes #3261.
Fixes #1741.
Added a testcase for linking in libgcc.
TODO:
1. still need to fix the INDIRECT_SYMBOL_LOCAL problem on Darwin/386.
2. still need to enable the libgcc test on Linux/ARM, because 5l can't deal
with thumb libgcc.
Tested on Darwin/amd64, Darwin/386, FreeBSD/amd64, FreeBSD/386, Linux/amd64,
Linux/386, Linux/ARM, Windows/amd64, Windows/386
R=iant, rsc, bradfitz, coldredlemur
CC=golang-dev
https://golang.org/cl/5822049
2012-08-16 13:42:34 -06:00
|
|
|
|
2014-10-02 00:15:36 -06:00
|
|
|
:: cgo tests inspect the traceback for runtime functions
|
runtime: keep g->syscallsp consistent after cgo->Go callbacks
Normally, the caller to runtime.entersyscall() must not return before
calling runtime.exitsyscall(), lest g->syscallsp become a dangling
pointer. runtime.cgocallbackg() violates this constraint. To work around
this, save g->syscallsp and g->syscallpc around cgo->Go callbacks, then
restore them after calling runtime.entersyscall(), which restores the
syscall stack frame pointer saved by cgocall. This allows the GC to
correctly trace a goroutine that is currently returning from a
Go->cgo->Go chain.
This also adds a check to proc.c that panics if g->syscallsp is clearly
invalid. It is not 100% foolproof, as it will not catch a case where the
stack was popped then pushed back beyond g->syscallsp, but it does catch
the present cgo issue and makes existing tests fail without the bugfix.
Fixes #7978.
LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, minux, bradfitz, iant, gobot, rsc
CC=golang-codereviews, rsc
https://golang.org/cl/131910043
2014-09-24 11:20:25 -06:00
|
|
|
set OLDGOTRACEBACK=%GOTRACEBACK%
|
|
|
|
set GOTRACEBACK=2
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\misc\cgo\test
|
2012-09-18 20:07:25 -06:00
|
|
|
go test ..\misc\cgo\test
|
|
|
|
if errorlevel 1 goto fail
|
|
|
|
echo.
|
2013-04-22 14:42:04 -06:00
|
|
|
|
runtime: keep g->syscallsp consistent after cgo->Go callbacks
Normally, the caller to runtime.entersyscall() must not return before
calling runtime.exitsyscall(), lest g->syscallsp become a dangling
pointer. runtime.cgocallbackg() violates this constraint. To work around
this, save g->syscallsp and g->syscallpc around cgo->Go callbacks, then
restore them after calling runtime.entersyscall(), which restores the
syscall stack frame pointer saved by cgocall. This allows the GC to
correctly trace a goroutine that is currently returning from a
Go->cgo->Go chain.
This also adds a check to proc.c that panics if g->syscallsp is clearly
invalid. It is not 100% foolproof, as it will not catch a case where the
stack was popped then pushed back beyond g->syscallsp, but it does catch
the present cgo issue and makes existing tests fail without the bugfix.
Fixes #7978.
LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, minux, bradfitz, iant, gobot, rsc
CC=golang-codereviews, rsc
https://golang.org/cl/131910043
2014-09-24 11:20:25 -06:00
|
|
|
set GOTRACEBACK=%OLDGOTRACEBACK%
|
|
|
|
set OLDGOTRACEBACK=
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\misc\cgo\testso
|
2013-04-22 14:42:04 -06:00
|
|
|
cd ..\misc\cgo\testso
|
|
|
|
set FAIL=0
|
|
|
|
call test.bat
|
|
|
|
cd ..\..\..\src
|
|
|
|
if %FAIL%==1 goto fail
|
|
|
|
echo.
|
2012-08-06 19:38:35 -06:00
|
|
|
:nocgo
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\doc\progs
|
2013-03-24 19:13:34 -06:00
|
|
|
go run "%GOROOT%\test\run.go" - ..\doc\progs
|
2012-09-02 13:49:03 -06:00
|
|
|
if errorlevel 1 goto fail
|
|
|
|
echo.
|
|
|
|
|
2012-03-05 20:47:23 -07:00
|
|
|
:: TODO: The other tests in run.bash.
|
|
|
|
|
2012-11-14 17:40:10 -07:00
|
|
|
|
|
|
|
set OLDGOMAXPROCS=%GOMAXPROCS%
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
echo ##### ..\test
|
2012-03-12 19:51:28 -06:00
|
|
|
cd ..\test
|
|
|
|
set FAIL=0
|
2012-11-14 17:40:10 -07:00
|
|
|
set GOMAXPROCS=
|
2012-03-05 20:47:23 -07:00
|
|
|
go run run.go
|
2012-03-12 19:51:28 -06:00
|
|
|
if errorlevel 1 set FAIL=1
|
|
|
|
cd ..\src
|
2012-03-05 20:47:23 -07:00
|
|
|
echo.
|
2012-03-12 19:51:28 -06:00
|
|
|
if %FAIL%==1 goto fail
|
2012-02-03 22:48:31 -07:00
|
|
|
|
2012-11-14 17:40:10 -07:00
|
|
|
set GOMAXPROCS=%OLDGOMAXPROCS%
|
|
|
|
set OLDGOMAXPROCS=
|
|
|
|
|
2014-12-10 08:45:59 -07:00
|
|
|
:: echo ##### Checking API compatibility.
|
2014-12-05 14:24:20 -07:00
|
|
|
go run "%GOROOT%\src\cmd\api\run.go"
|
|
|
|
if errorlevel 1 goto fail
|
2012-03-19 21:04:20 -06:00
|
|
|
echo.
|
|
|
|
|
2012-02-03 22:48:31 -07:00
|
|
|
echo ALL TESTS PASSED
|
|
|
|
goto end
|
|
|
|
|
|
|
|
:fail
|
|
|
|
set GOBUILDFAIL=1
|
|
|
|
|
|
|
|
:end
|