mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
testing: check that tests and benchmarks do not affect GOMAXPROCS
Plus fix spoiling of GOMAXPROCS in 2 existing rwmutex tests. Plus fix benchmark output to stdout (now it outputs to stderr like all other output). R=rsc CC=golang-dev https://golang.org/cl/4529111
This commit is contained in:
parent
9baaa6f742
commit
79b397b27e
3 changed files with 15 additions and 2 deletions
|
|
@ -171,6 +171,7 @@ func RunTests(matchString func(pat, str string) (bool, os.Error), tests []Intern
|
|||
if len(tests) == 0 {
|
||||
println("testing: warning: no tests to run")
|
||||
}
|
||||
procs := runtime.GOMAXPROCS(-1)
|
||||
for i := 0; i < len(tests); i++ {
|
||||
matched, err := matchString(*match, tests[i].Name)
|
||||
if err != nil {
|
||||
|
|
@ -190,6 +191,11 @@ func RunTests(matchString func(pat, str string) (bool, os.Error), tests []Intern
|
|||
<-t.ch
|
||||
ns += time.Nanoseconds()
|
||||
tstr := fmt.Sprintf("(%.2f seconds)", float64(ns)/1e9)
|
||||
if p := runtime.GOMAXPROCS(-1); t.failed == false && p != procs {
|
||||
t.failed = true
|
||||
t.errors = fmt.Sprintf("%s left GOMAXPROCS set to %d\n", tests[i].Name, p)
|
||||
procs = p
|
||||
}
|
||||
if t.failed {
|
||||
println("--- FAIL:", tests[i].Name, tstr)
|
||||
print(t.errors)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue