build: use run.go for running tests

Also, tweak run.go to use no more than 2x the
number of CPUs, and only one on ARM.

53.85u 13.33s 53.69r 	 ./run
50.68u 12.13s 18.85r 	 go run run.go

Fixes #2833.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754047
This commit is contained in:
Russ Cox 2012-03-05 22:47:23 -05:00
parent 4e110af169
commit 5e41fe0e45
3 changed files with 14 additions and 4 deletions

View File

@ -105,7 +105,7 @@ $BROKEN ||
) || exit $?
(xcd ../test
./run
time go run run.go
) || exit $?
echo

View File

@ -36,7 +36,14 @@ go test sync -short -timeout=120s -cpu=10
if errorlevel 1 goto fail
echo.
:: TODO: The other tests in run.bash, especially $GOROOT/test/run.
:: TODO: The other tests in run.bash.
echo # test
cd test
go run run.go
cd ..
if errorlevel 1 goto fail
echo.
echo ALL TESTS PASSED
goto end

View File

@ -30,7 +30,7 @@ import (
var (
verbose = flag.Bool("v", false, "verbose. if set, parallelism is set to 1.")
numParallel = flag.Int("n", 8, "number of parallel tests to run")
numParallel = flag.Int("n", 2*runtime.NumCPU(), "number of parallel tests to run")
summary = flag.Bool("summary", false, "show summary of results")
showSkips = flag.Bool("show_skips", false, "show skipped tests")
)
@ -60,7 +60,10 @@ const maxTests = 5000
func main() {
flag.Parse()
if *verbose {
// Disable parallelism if printing, or if running on
// (presumably underpowered) arm systems.
if *verbose || runtime.GOARCH == "arm" {
*numParallel = 1
}