How do you use the benchmark flags for the go (golang) gocheck testing framework? -
how 1 use flag options benchmarks gocheck testing framework? in link provided seems example provide running go test -check.b
, however, not provide additional comments on how works hard use it. not find -check in go documentation when did go test
nor when did go testflag
. in particular want know how use benchmark testing framework better , control how long runs or how many iterations runs etc etc. example in example provide:
func (s *mysuite) benchmarklogic(c *c) { := 0; < c.n; i++ { // logic benchmark } }
there variable c.n. how 1 specify variable? through actual program or through go test , flags or command line?
on side note, documentation go testflag
did talk -bench regex
, benchmem
, benchtime t
options, however, not talk -check.b
option. did try run these options described there didn't notice. gocheck work original options go test
?
the main problem see there no clear documentation how use gocheck tool or commands. accidentally gave wrong flag , threw me error message suggesting useful commands need (which limited description):
-check.b=false: run benchmarks -check.btime=1s: approximate run time each benchmark -check.f="": regular expression selecting tests and/or suites run -check.list=false: list names of tests run -check.v=false: verbose mode -check.vv=false: super verbose mode (disables output caching) -check.work=false: display , not remove test working directory -gocheck.b=false: run benchmarks -gocheck.btime=1s: approximate run time each benchmark -gocheck.f="": regular expression selecting tests and/or suites run -gocheck.list=false: list names of tests run -gocheck.v=false: verbose mode -gocheck.vv=false: super verbose mode (disables output caching) -gocheck.work=false: display , not remove test working directory -test.bench="": regular expression select benchmarks run -test.benchmem=false: print memory allocations benchmarks -test.benchtime=1s: approximate run time each benchmark -test.blockprofile="": write goroutine blocking profile named file after execution -test.blockprofilerate=1: if >= 0, calls runtime.setblockprofilerate() -test.coverprofile="": write coverage profile named file after execution -test.cpu="": comma-separated list of number of cpus use each test -test.cpuprofile="": write cpu profile named file during execution -test.memprofile="": write memory profile named file after execution -test.memprofilerate=0: if >=0, sets runtime.memprofilerate -test.outputdir="": directory in write profiles -test.parallel=1: maximum test parallelism -test.run="": regular expression select tests , examples run -test.short=false: run smaller test suite save time -test.timeout=0: if positive, sets aggregate time limit tests -test.v=false: verbose: print additional output
is writing wrong commands way tool? doesn't have flag or something?
see description_of_testing_flags:
-bench regexp run benchmarks matching regular expression. default, no benchmarks run. run benchmarks, use '-bench .' or '-bench=.'.
-check.b
works same way -test.bench
.
e.g. run benchmarks:
go test -check.b=.
to run specific benchmark:
go test -check.b=benchmarklogic
more information testing in go can found here
Comments
Post a Comment