Skip to content

Commit 43db6ff

Browse files
committed
Add support for gopherjs test --count flag.
It's useful for running a benchmark multiple times, to get a better benchmark comparison.
1 parent 9659c81 commit 43db6ff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tool.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ func main() {
305305
}
306306
bench := cmdTest.Flags().String("bench", "", "Run benchmarks matching the regular expression. By default, no benchmarks run. To run all benchmarks, use '--bench=.'.")
307307
benchtime := cmdTest.Flags().String("benchtime", "", "Run enough iterations of each benchmark to take t, specified as a time.Duration (for example, -benchtime 1h30s). The default is 1 second (1s).")
308+
count := cmdTest.Flags().String("count", "", "Run each test and benchmark n times (default 1). Examples are always run once.")
308309
run := cmdTest.Flags().String("run", "", "Run only those tests and examples matching the regular expression.")
309310
short := cmdTest.Flags().Bool("short", false, "Tell long-running tests to shorten their run time.")
310311
verbose := cmdTest.Flags().BoolP("verbose", "v", false, "Log all tests as they are run. Also print all text from Log and Logf calls even if the test succeeds.")
@@ -467,6 +468,9 @@ func main() {
467468
if *benchtime != "" {
468469
args = append(args, "-test.benchtime", *benchtime)
469470
}
471+
if *count != "" {
472+
args = append(args, "-test.count", *count)
473+
}
470474
if *run != "" {
471475
args = append(args, "-test.run", *run)
472476
}

0 commit comments

Comments
 (0)