mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
build: set the number of go testing process
This commit is contained in:
parent
c8dcb9584e
commit
12db418d39
1 changed files with 7 additions and 1 deletions
|
|
@ -55,6 +55,7 @@ import (
|
|||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -288,6 +289,7 @@ func goToolArch(arch string, cc string, subcmd string, args ...string) *exec.Cmd
|
|||
func doTest(cmdline []string) {
|
||||
var (
|
||||
coverage = flag.Bool("coverage", false, "Whether to record code coverage")
|
||||
process = flag.String("process", "1", "How many processes available to run tests")
|
||||
)
|
||||
flag.CommandLine.Parse(cmdline)
|
||||
env := build.Env()
|
||||
|
|
@ -305,7 +307,11 @@ func doTest(cmdline []string) {
|
|||
gotest := goTool("test", buildFlags(env)...)
|
||||
// Test a single package at a time. CI builders are slow
|
||||
// and some tests run into timeouts under load.
|
||||
if _, err := strconv.Atoi(*process); err == nil {
|
||||
gotest.Args = append(gotest.Args, "-p", *process)
|
||||
} else {
|
||||
gotest.Args = append(gotest.Args, "-p", "1")
|
||||
}
|
||||
if *coverage {
|
||||
gotest.Args = append(gotest.Args, "-covermode=atomic", "-cover")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue