Skip to content

Commit

Permalink
Merge #127205
Browse files Browse the repository at this point in the history
127205: roachtest: fix stdout logging when parallelism=1 r=srosenberg a=DarrylWong

When parallelism=1, the roachtest runner logs test output to stdout. However, in #124780, the creation of the logger was moved to before the assignment of parallelism in the case that only one test is run.

Release note: none
Epic: none
Fixes: none

Co-authored-by: DarrylWong <[email protected]>
  • Loading branch information
craig[bot] and DarrylWong committed Jul 16, 2024
2 parents 7862594 + d160a65 commit 73ecc8b
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions pkg/cmd/roachtest/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ func runTests(register func(registry.Registry), filter *registry.TestFilter) err
}
}

specs, err := testsToRun(r, filter, roachtestflags.RunSkipped, roachtestflags.SelectProbability, true)
if err != nil {
return err
}

n := len(specs)
if n*roachtestflags.Count < parallelism {
// Don't spin up more workers than necessary. This has particular
// implications for the common case of running a single test once: if
// parallelism is set to 1, we'll use teeToStdout below to get logs to
// stdout/stderr.
parallelism = n * roachtestflags.Count
}

artifactsDir := roachtestflags.ArtifactsDir
literalArtifactsDir := roachtestflags.LiteralArtifactsDir
if literalArtifactsDir == "" {
Expand Down Expand Up @@ -137,19 +151,6 @@ func runTests(register func(registry.Registry), filter *registry.TestFilter) err
return err
}

specs, err := testsToRun(r, filter, roachtestflags.RunSkipped, roachtestflags.SelectProbability, true)
if err != nil {
return err
}

n := len(specs)
if n*roachtestflags.Count < parallelism {
// Don't spin up more workers than necessary. This has particular
// implications for the common case of running a single test once: if
// parallelism is set to 1, we'll use teeToStdout below to get logs to
// stdout/stderr.
parallelism = n * roachtestflags.Count
}
if opt.debugMode == DebugKeepAlways && n > 1 {
return errors.Newf("--debug-always is only allowed when running a single test")
}
Expand Down

0 comments on commit 73ecc8b

Please sign in to comment.