]> Cypherpunks repositories - gostls13.git/commit
testing: error if -parallel is given N<1
authorDaniel Martí <mvdan@mvdan.cc>
Wed, 9 Aug 2017 07:56:08 +0000 (16:56 +0900)
committerIan Lance Taylor <iant@golang.org>
Fri, 25 Aug 2017 22:47:57 +0000 (22:47 +0000)
commit86dde2debbab6dec105e0bf74ef74d7220974dde
tree25ac2691f260f4740dbffa4ce21fc759dde2dc79
parent7e455b628c2d9f2286270238fbd2b1ab38643a2a
testing: error if -parallel is given N<1

Otherwise, if there are any parallel tests, it will hang and panic with
"all goroutines are asleep - deadlock!".

Do not use flag.Uint to handle the error for us because we also want to
error on N==0, and because it would make setting the default to
GOMAXPROCS(0) more difficult, since it's an int.

Check for it right after flag.Parse, and mimic flag errors by printing
the usage and returning exit code 2.

Fixes #20542.

Change-Id: I0c9d4587f83d406a8f5e42ed74e40be46d639ffb
Reviewed-on: https://go-review.googlesource.com/54150
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/go_test.go
src/testing/testing.go