• Daniel Martí's avatar
    testing: error if -parallel is given N<1 · 86dde2de
    Daniel Martí authored
    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: 's avatarIan Lance Taylor <iant@golang.org>
    86dde2de
testing.go 37.9 KB