From 5c8f21741620ef6a52e185bbc920499581901c9e Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Sun, 29 Jan 2017 00:01:07 +0100 Subject: [PATCH] Add --benchtime flag to gopherjs test. (#578) It operates like the same flag of go test command. --- tool.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tool.go b/tool.go index 577abb2f5..32af0fa0f 100644 --- a/tool.go +++ b/tool.go @@ -310,6 +310,7 @@ func main() { Short: "test packages", } bench := cmdTest.Flags().String("bench", "", "Run benchmarks matching the regular expression. By default, no benchmarks run. To run all benchmarks, use '--bench=.'.") + 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).") run := cmdTest.Flags().String("run", "", "Run only those tests and examples matching the regular expression.") short := cmdTest.Flags().Bool("short", false, "Tell long-running tests to shorten their run time.") 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.") @@ -472,6 +473,9 @@ func main() { if *bench != "" { args = append(args, "-test.bench", *bench) } + if *benchtime != "" { + args = append(args, "-test.benchtime", *benchtime) + } if *run != "" { args = append(args, "-test.run", *run) }