@@ -18,19 +18,18 @@ func init() {
1818 carapace .Gen (testCmd ).Standalone ()
1919 testCmd .Flags ().SetInterspersed (false )
2020
21- testCmd .Flags ().StringS ("C" , "C" , "" , "Change to dir before running the command" )
2221 testCmd .Flags ().StringS ("bench" , "bench" , "" , "Run only those benchmarks matching a regular expression" )
2322 testCmd .Flags ().BoolS ("benchmem" , "benchmem" , false , "Print memory allocation statistics for benchmarks" )
2423 testCmd .Flags ().StringS ("benchtime" , "benchtime" , "" , "Run enough iterations of each benchmark to take t" )
2524 testCmd .Flags ().StringS ("blockprofile" , "blockprofile" , "" , "Write a goroutine blocking profile to the specified file when all tests are complete" )
2625 testCmd .Flags ().StringS ("blockprofilerate" , "blockprofilerate" , "" , "Control the detail provided in goroutine blocking profiles by calling runtime.SetBlockProfileRate with n" )
26+ testCmd .Flags ().BoolS ("c" , "c" , false , "Compile the test binary to pkg.test in the current directory but do not run it" )
2727 testCmd .Flags ().StringS ("count" , "count" , "" , "Run each test, benchmark, and fuzz seed n times" )
28- testCmd .Flags ().BoolS ("cover" , "cover" , false , "Enable coverage analysis" )
2928 testCmd .Flags ().StringS ("covermode" , "covermode" , "" , "Set the mode for coverage analysis for the package[s] being tested" )
30- testCmd .Flags ().StringS ("coverpkg" , "coverpkg" , "" , "Apply coverage analysis in each test to packages matching the patterns" )
3129 testCmd .Flags ().StringS ("coverprofile" , "coverprofile" , "" , "Write a coverage profile to the file after all tests have passed" )
3230 testCmd .Flags ().StringS ("cpu" , "cpu" , "" , "Specify a list of GOMAXPROCS values for which the tests, benchmarks or fuzz tests should be executed" )
3331 testCmd .Flags ().StringS ("cpuprofile" , "cpuprofile" , "" , "Write a CPU profile to the specified file before exiting" )
32+ testCmd .Flags ().StringS ("exec" , "exec" , "" , "Run the test binary using xprog" )
3433 testCmd .Flags ().BoolS ("failfast" , "failfast" , false , "Do not start new tests after the first test failure." )
3534 testCmd .Flags ().BoolS ("fullpath" , "fullpath" , false , "Show full file names in the error messages" )
3635 testCmd .Flags ().StringS ("fuzz" , "fuzz" , "" , "Run the fuzz test matching the regular expression" )
@@ -42,35 +41,84 @@ func init() {
4241 testCmd .Flags ().StringS ("memprofilerate" , "memprofilerate" , "" , "Enable more precise (and expensive) memory allocation profiles by setting runtime.MemProfileRate" )
4342 testCmd .Flags ().StringS ("mutexprofile" , "mutexprofile" , "" , "Write a mutex contention profile to the specified file when all tests are complete" )
4443 testCmd .Flags ().StringS ("mutexprofilefraction" , "mutexprofilefraction" , "" , "Sample 1 in n stack traces of goroutines holding a contended mutex" )
44+ testCmd .Flags ().StringS ("o" , "o" , "" , "Compile the test binary to the named file" )
4545 testCmd .Flags ().StringS ("outputdir" , "outputdir" , "" , "Place output files from profiling in the specified directory" )
4646 testCmd .Flags ().StringS ("parallel" , "parallel" , "" , "Allow parallel execution of test functions" )
4747 testCmd .Flags ().StringS ("run" , "run" , "" , "Run only those tests, examples, and fuzz tests matching the regular expression" )
4848 testCmd .Flags ().BoolS ("short" , "short" , false , "Tell long-running tests to shorten their run time" )
4949 testCmd .Flags ().StringS ("shuffle" , "shuffle" , "" , "Randomize the execution order of tests and benchmarks" )
5050 testCmd .Flags ().StringS ("skip" , "skip" , "" , "Run only those tests, examples, fuzz tests, and benchmarks that do not match the regular expression" )
51+ testCmd .Flags ().StringS ("test.bench" , "test.bench" , "" , "run only benchmarks matching regexp" )
52+ testCmd .Flags ().BoolS ("test.benchmem" , "test.benchmem" , false , "print memory allocations for benchmarks" )
53+ testCmd .Flags ().StringS ("test.benchtime" , "test.benchtime" , "" , "run each benchmark for duration d or N times if `d` is of the form Nx" )
54+ testCmd .Flags ().StringS ("test.blockprofile" , "test.blockprofile" , "" , "write a goroutine blocking profile to file" )
55+ testCmd .Flags ().StringS ("test.blockprofilerate" , "test.blockprofilerate" , "" , "set blocking profile rate" )
56+ testCmd .Flags ().StringS ("test.count" , "test.count" , "" , "run tests and benchmarks n times" )
57+ testCmd .Flags ().StringS ("test.coverprofile" , "test.coverprofile" , "" , "write a coverage profile to file" )
58+ testCmd .Flags ().StringS ("test.cpu" , "test.cpu" , "" , "comma-separated list of cpu counts to run each test with" )
59+ testCmd .Flags ().StringS ("test.cpuprofile" , "test.cpuprofile" , "" , "write a cpu profile to file" )
60+ testCmd .Flags ().BoolS ("test.failfast" , "test.failfast" , false , "do not start new tests after the first test failure" )
61+ testCmd .Flags ().BoolS ("test.fullpath" , "test.fullpath" , false , "show full file names in error messages" )
62+ testCmd .Flags ().StringS ("test.fuzz" , "test.fuzz" , "" , "run the fuzz test matching regexp" )
63+ testCmd .Flags ().StringS ("test.fuzzcachedir" , "test.fuzzcachedir" , "" , "directory where interesting fuzzing inputs are stored" )
64+ testCmd .Flags ().StringS ("test.fuzzminimizetime" , "test.fuzzminimizetime" , "" , "time to spend minimizing a value after finding a failing input" )
65+ testCmd .Flags ().StringS ("test.fuzztime" , "test.fuzztime" , "" , "time to spend fuzzing; default is to run indefinitely" )
66+ testCmd .Flags ().BoolS ("test.fuzzworker" , "test.fuzzworker" , false , "coordinate with the parent process to fuzz random values" )
67+ testCmd .Flags ().StringS ("test.gocoverdir" , "test.gocoverdir" , "" , "write coverage intermediate files to this directory" )
68+ testCmd .Flags ().StringS ("test.list" , "test.list" , "" , "list tests, examples, and benchmarks matching regexp then exit" )
69+ testCmd .Flags ().StringS ("test.memprofile" , "test.memprofile" , "" , "write an allocation profile to file" )
70+ testCmd .Flags ().StringS ("test.memprofilerate" , "test.memprofilerate" , "" , "set memory allocation profiling rate" )
71+ testCmd .Flags ().StringS ("test.mutexprofile" , "test.mutexprofile" , "" , "write a mutex contention profile to the named file after execution" )
72+ testCmd .Flags ().StringS ("test.mutexprofilefraction" , "test.mutexprofilefraction" , "" , "if >= 0, calls runtime.SetMutexProfileFraction()" )
73+ testCmd .Flags ().StringS ("test.outputdir" , "test.outputdir" , "" , "write profiles to dir" )
74+ testCmd .Flags ().BoolS ("test.paniconexit0" , "test.paniconexit0" , false , "panic on call to os.Exit(0)" )
75+ testCmd .Flags ().StringS ("test.parallel" , "test.parallel" , "" , "run at most n tests in parallel" )
76+ testCmd .Flags ().StringS ("test.run" , "test.run" , "" , "run only tests and examples matching regexp" )
77+ testCmd .Flags ().BoolS ("test.short" , "test.short" , false , "run smaller test suite to save time" )
78+ testCmd .Flags ().StringS ("test.shuffle" , "test.shuffle" , "" , "randomize the execution order of tests and benchmarks" )
79+ testCmd .Flags ().StringS ("test.skip" , "test.skip" , "" , "do not list or run tests matching regexp" )
80+ testCmd .Flags ().StringS ("test.testlogfile" , "test.testlogfile" , "" , "write test action log to file" )
81+ testCmd .Flags ().StringS ("test.timeout" , "test.timeout" , "" , "panic test binary after duration d" )
82+ testCmd .Flags ().StringS ("test.trace" , "test.trace" , "" , "write an execution trace to file" )
83+ testCmd .Flags ().BoolS ("test.v" , "test.v" , false , "verbose: print additional output" )
5184 testCmd .Flags ().StringS ("timeout" , "timeout" , "" , "If a test binary runs longer than duration d, panic" )
5285 testCmd .Flags ().StringS ("trace" , "trace" , "" , "Write an execution trace to the specified file before exiting" )
53- testCmd .Flags ().BoolS ("v" , "v" , false , "Verbose output: log all tests as they are run" )
5486 testCmd .Flags ().StringS ("vet" , "vet" , "" , "Configure the invocation of \" go vet\" during \" go test\" to use the comma-separated list of vet checks" )
87+ addBuildFlags (testCmd )
5588 rootCmd .AddCommand (testCmd )
5689
5790 carapace .Gen (testCmd ).FlagCompletion (carapace.ActionMap {
58- "C" : carapace .ActionDirectories (),
59- "bench" : golang .ActionTests (golang.TestOpts {Benchmark : true }).UniqueList ("/" ),
60- "blockprofile" : carapace .ActionFiles (),
61- "covermode" : carapace .ActionValues ("set" , "count,atomic" ),
62- "coverpkg" : golang .ActionPackages ().List ("," ),
63- "coverprofile" : carapace .ActionFiles (),
64- "cpuprofile" : carapace .ActionFiles (),
65- "fuzz" : golang .ActionTests (golang.TestOpts {Fuzz : true }),
66- "list" : golang .ActionTests (golang.TestOpts {}.Default ()),
67- "memprofile" : carapace .ActionFiles (),
68- "mutexprofile" : carapace .ActionFiles (),
69- "outputdir" : carapace .ActionDirectories (),
70- "run" : golang .ActionTests (golang.TestOpts {}.Default ()).UniqueList ("/" ),
71- "shuffle" : carapace .ActionValues ("off" , "on" ).StyleF (style .ForKeyword ),
72- "skip" : golang .ActionTests (golang.TestOpts {}.Default ()).UniqueList ("/" ),
73- "trace" : carapace .ActionFiles (),
91+ "bench" : golang .ActionTests (golang.TestOpts {Benchmark : true }).UniqueList ("/" ),
92+ "blockprofile" : carapace .ActionFiles (),
93+ "covermode" : carapace .ActionValues ("set" , "count,atomic" ),
94+ "coverpkg" : golang .ActionPackages ().List ("," ),
95+ "coverprofile" : carapace .ActionFiles (),
96+ "cpuprofile" : carapace .ActionFiles (),
97+ "fuzz" : golang .ActionTests (golang.TestOpts {Fuzz : true }),
98+ "list" : golang .ActionTests (golang.TestOpts {}.Default ()),
99+ "memprofile" : carapace .ActionFiles (),
100+ "mutexprofile" : carapace .ActionFiles (),
101+ "o" : carapace .ActionFiles (),
102+ "outputdir" : carapace .ActionDirectories (),
103+ "run" : golang .ActionTests (golang.TestOpts {}.Default ()).UniqueList ("/" ),
104+ "shuffle" : carapace .ActionValues ("off" , "on" ).StyleF (style .ForKeyword ),
105+ "skip" : golang .ActionTests (golang.TestOpts {}.Default ()).UniqueList ("/" ),
106+ "test.bench" : golang .ActionTests (golang.TestOpts {Benchmark : true }),
107+ "test.blockprofile" : carapace .ActionFiles (),
108+ "test.coverprofile" : carapace .ActionFiles (),
109+ "test.cpuprofile" : carapace .ActionFiles (),
110+ "test.fuzz" : golang .ActionTests (golang.TestOpts {Fuzz : true }),
111+ "test.fuzzcachedir" : carapace .ActionDirectories (),
112+ "test.gocoverdir" : carapace .ActionDirectories (),
113+ "test.list" : golang .ActionTests (golang.TestOpts {Benchmark : true , Example : true , Test : true }),
114+ "test.memprofile" : carapace .ActionFiles (),
115+ "test.mutexprofile" : carapace .ActionFiles (),
116+ "test.outputdir" : carapace .ActionDirectories (),
117+ "test.run" : golang .ActionTests (golang.TestOpts {Example : true , Test : true }),
118+ "test.skip" : golang .ActionTests (golang.TestOpts {Test : true }),
119+ "test.testlogfile" : carapace .ActionFiles (),
120+ "test.trace" : carapace .ActionFiles (),
121+ "trace" : carapace .ActionFiles (),
74122 "vet" : carapace .Batch (
75123 carapace .ActionValues ("off" ).StyleF (style .ForKeyword ),
76124 golang .ActionAnalyzers (),
0 commit comments