Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,16 @@ func run(
return nil, fmt.Errorf("the '--coverprofile' flag requires the '--cover' flag")
}
if testFlags.Random && testFlags.Seed > 0 {
fmt.Printf(
"%s Both '--seed' and '--random' flags are used. Hence, the '--random' flag will be ignored.\n",
logger.Info(fmt.Sprintf(
"%s Both '--seed' and '--random' flags are used. Hence, the '--random' flag will be ignored.",
output.WarningEmoji(),
)
))
}
if testFlags.Cover && testFlags.Jobs > 1 {
logger.Info(fmt.Sprintf(
"%s The '--jobs' flag is ignored when coverage is enabled. Tests will run sequentially.",
output.WarningEmoji(),
))
}

var filenames []string
Expand Down Expand Up @@ -273,8 +279,12 @@ func testCode(
}

// Limit concurrency to flags.Jobs, defaulting to number of CPU cores.
// When coverage is enabled, force sequential execution because the
// coverage report is shared across all test file goroutines.
jobs := flags.Jobs
if jobs <= 0 {
if flags.Cover {
Comment thread
turbolent marked this conversation as resolved.
jobs = 1
} else if jobs <= 0 {
jobs = goRuntime.NumCPU()
}
sem := make(chan struct{}, jobs)
Expand Down
Loading