Skip to content

Commit

Permalink
tools/check: increase the parallelism for building test binaries (#48985
Browse files Browse the repository at this point in the history
)

ref #31880
  • Loading branch information
bb7133 authored Nov 30, 2023
1 parent 333e8c3 commit 86a7ab3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/check/ut.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"regexp"
"runtime"
"sort"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -97,6 +98,7 @@ func (t *task) String() string {
}

var p int
var buildParallel int
var workDir string

func cmdList(args ...string) bool {
Expand Down Expand Up @@ -309,7 +311,7 @@ func cmdRun(args ...string) bool {
tasks = tmp
}

fmt.Printf("building task finish, maxproc=%d, count=%d, takes=%v\n", p, len(tasks), time.Since(start))
fmt.Printf("building task finish, parallelism=%d, count=%d, takes=%v\n", buildParallel, len(tasks), time.Since(start))

taskCh := make(chan task, 100)
works := make([]numa, p)
Expand Down Expand Up @@ -448,6 +450,8 @@ func main() {

// Get the correct count of CPU if it's in docker.
p = runtime.GOMAXPROCS(0)
// We use 2 * p for `go build` to make it faster.
buildParallel = p * 2
var err error
workDir, err = os.Getwd()
if err != nil {
Expand Down Expand Up @@ -870,7 +874,7 @@ func buildTestBinaryMulti(pkgs []string) error {
}

var cmd *exec.Cmd
cmd = exec.Command("go", "test", "--tags=intest", "--exec", xprogPath, "-vet", "off", "-count", "0")
cmd = exec.Command("go", "test", "--tags=intest", "-p", strconv.Itoa(buildParallel), "--exec", xprogPath, "-vet", "off", "-count", "0")
if coverprofile != "" {
cmd.Args = append(cmd.Args, "-cover")
}
Expand Down

0 comments on commit 86a7ab3

Please sign in to comment.