@@ -32,7 +32,8 @@ type Runner struct {
3232 Verbose bool // If true, provides detailed logging.
3333 RunCount int // Number of times to run the tests.
3434 RerunCount int // Number of additional runs for tests that initially fail.
35- UseRace bool // Enable race detector.
35+ GoTestCountFlag * int // Run go test with -count flag.
36+ GoTestRaceFlag bool // Run go test with -race flag.
3637 Timeout time.Duration // Test timeout
3738 Tags []string // Build tags.
3839 UseShuffle bool // Enable test shuffling. -shuffle=on flag.
@@ -84,7 +85,7 @@ func (r *Runner) RunTestPackages(packages []string) (*reports.TestReport, error)
8485
8586 report := & reports.TestReport {
8687 GoProject : r .prettyProjectPath ,
87- RaceDetection : r .UseRace ,
88+ RaceDetection : r .GoTestRaceFlag ,
8889 ExcludedTests : r .SkipTests ,
8990 SelectedTests : r .SelectTests ,
9091 Results : results ,
@@ -120,7 +121,7 @@ func (r *Runner) RunTestCmd(testCmd []string) (*reports.TestReport, error) {
120121
121122 report := & reports.TestReport {
122123 GoProject : r .prettyProjectPath ,
123- RaceDetection : r .UseRace ,
124+ RaceDetection : r .GoTestRaceFlag ,
124125 ExcludedTests : r .SkipTests ,
125126 SelectedTests : r .SelectTests ,
126127 Results : results ,
@@ -143,8 +144,11 @@ type exitCoder interface {
143144
144145// runTestPackage runs the tests for a given package and returns the path to the output file.
145146func (r * Runner ) runTestPackage (packageName string ) (string , bool , error ) {
146- args := []string {"test" , packageName , "-json" , "-count=1" }
147- if r .UseRace {
147+ args := []string {"test" , packageName , "-json" }
148+ if r .GoTestCountFlag != nil {
149+ args = append (args , fmt .Sprintf ("-count=%d" , * r .GoTestCountFlag ))
150+ }
151+ if r .GoTestRaceFlag {
148152 args = append (args , "-race" )
149153 }
150154 if r .Timeout > 0 {
@@ -748,7 +752,7 @@ func (r *Runner) RerunFailedTests(failedTests []reports.TestResult) (*reports.Te
748752 }
749753
750754 // Add other test flags
751- if r .UseRace {
755+ if r .GoTestRaceFlag {
752756 cmd = append (cmd , "-race" )
753757 }
754758 if r .Timeout > 0 {
@@ -779,7 +783,7 @@ func (r *Runner) RerunFailedTests(failedTests []reports.TestResult) (*reports.Te
779783
780784 report := & reports.TestReport {
781785 GoProject : r .prettyProjectPath ,
782- RaceDetection : r .UseRace ,
786+ RaceDetection : r .GoTestRaceFlag ,
783787 ExcludedTests : r .SkipTests ,
784788 SelectedTests : r .SelectTests ,
785789 Results : rerunResults ,
0 commit comments