1
0
mirror of https://github.com/golang/go synced 2024-09-30 14:38:33 -06:00

cmd/go: clarify test -run and -bench pattern matching

Make it clearer that -test=X/Y runs all the tests matching X,
even if they don't have sub-tests matching Y.

Fixes #20589.

Change-Id: Ic27e89e748d60f67b50c68445ec0480066bdf207
Reviewed-on: https://go-review.googlesource.com/46030
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2017-06-16 11:16:37 -04:00
parent 3e0c21e033
commit 10d855198c
2 changed files with 36 additions and 18 deletions

View File

@ -1417,12 +1417,17 @@
// control the execution of any test: // control the execution of any test:
// //
// -bench regexp // -bench regexp
// Run (sub)benchmarks matching a regular expression. // Run only those benchmarks matching a regular expression.
// The given regular expression is split into smaller ones by // By default, no benchmarks are run.
// top-level '/', where each must match the corresponding part of a // To run all benchmarks, use '-bench .' or '-bench=.'.
// benchmark's identifier. // The regular expression is split by unbracketed slash (/)
// By default, no benchmarks run. To run all benchmarks, // characters into a sequence of regular expressions, and each
// use '-bench .' or '-bench=.'. // part of a benchmark's identifier must match the corresponding
// element in the sequence, if any. Possible parents of matches
// are run with b.N=1 to identify sub-benchmarks. For example,
// given -bench=X/Y, top-level benchmarks matching X are run
// with b.N=1 to find any sub-benchmarks matching Y, which are
// then run in full.
// //
// -benchtime t // -benchtime t
// Run enough iterations of each benchmark to take t, specified // Run enough iterations of each benchmark to take t, specified
@ -1479,9 +1484,13 @@
// //
// -run regexp // -run regexp
// Run only those tests and examples matching the regular expression. // Run only those tests and examples matching the regular expression.
// For tests the regular expression is split into smaller ones by // For tests, the regular expression is split by unbracketed slash (/)
// top-level '/', where each must match the corresponding part of a // characters into a sequence of regular expressions, and each part
// test's identifier. // of a test's identifier must match the corresponding element in
// the sequence, if any. Note that possible parents of matches are
// run too, so that -run=X/Y matches and runs and reports the result
// of all tests matching X, even those without sub-tests matching Y,
// because it must run them to look for those sub-tests.
// //
// -short // -short
// Tell long-running tests to shorten their run time. // Tell long-running tests to shorten their run time.

View File

@ -142,12 +142,17 @@ control the execution of any test:
const testFlag2 = ` const testFlag2 = `
-bench regexp -bench regexp
Run (sub)benchmarks matching a regular expression. Run only those benchmarks matching a regular expression.
The given regular expression is split into smaller ones by By default, no benchmarks are run.
top-level '/', where each must match the corresponding part of a To run all benchmarks, use '-bench .' or '-bench=.'.
benchmark's identifier. The regular expression is split by unbracketed slash (/)
By default, no benchmarks run. To run all benchmarks, characters into a sequence of regular expressions, and each
use '-bench .' or '-bench=.'. part of a benchmark's identifier must match the corresponding
element in the sequence, if any. Possible parents of matches
are run with b.N=1 to identify sub-benchmarks. For example,
given -bench=X/Y, top-level benchmarks matching X are run
with b.N=1 to find any sub-benchmarks matching Y, which are
then run in full.
-benchtime t -benchtime t
Run enough iterations of each benchmark to take t, specified Run enough iterations of each benchmark to take t, specified
@ -204,9 +209,13 @@ const testFlag2 = `
-run regexp -run regexp
Run only those tests and examples matching the regular expression. Run only those tests and examples matching the regular expression.
For tests the regular expression is split into smaller ones by For tests, the regular expression is split by unbracketed slash (/)
top-level '/', where each must match the corresponding part of a characters into a sequence of regular expressions, and each part
test's identifier. of a test's identifier must match the corresponding element in
the sequence, if any. Note that possible parents of matches are
run too, so that -run=X/Y matches and runs and reports the result
of all tests matching X, even those without sub-tests matching Y,
because it must run them to look for those sub-tests.
-short -short
Tell long-running tests to shorten their run time. Tell long-running tests to shorten their run time.