tweak test/bench's help around filtering & libtest
authorDale Wijnand <dale.wijnand@gmail.com>
Wed, 11 Apr 2018 06:39:13 +0000 (07:39 +0100)
committerDale Wijnand <dale.wijnand@gmail.com>
Wed, 11 Apr 2018 08:56:28 +0000 (09:56 +0100)
Attempt to bring more clarity about test/bench's filtering arg by
detailing the distinction and integration between cargo's test/bench and
libtest.

Also make sure to mention how to see libtest's help/usage message.

Fixes #5337

src/bin/commands/bench.rs
src/bin/commands/run.rs
src/bin/commands/test.rs

index 01676b51500f622c6d8a54d5a5477c6ae07df676..af70656980db9d61538dd83a0c83ff6554cc2d30 100644 (file)
@@ -45,9 +45,12 @@ pub fn cli() -> App {
         ))
         .after_help(
             "\
-All of the trailing arguments are passed to the benchmark binaries generated
-for filtering benchmarks and generally providing options configuring how they
-run.
+The benchmark filtering argument `BENCHNAME` and all the arguments following the
+two dashes (`--`) are passed to the benchmark binaries and thus to libtest
+(rustc's built in unit-test and micro-benchmarking framework).  If you're
+passing arguments to both Cargo and the binary, the ones after `--` go to the
+binary, the ones before go to Cargo.  For details about libtest's arguments see
+the output of `cargo bench -- --help`.
 
 If the --package argument is given, then SPEC is a package id specification
 which indicates which package should be benchmarked. If it is not given, then
index 77e5d8e13b9ef22e0aeea0067d312ed327771684..0858e96a591df4e777391b0b977d549e53d8de6b 100644 (file)
@@ -27,9 +27,9 @@ bin target it will be run. Otherwise `--bin` specifies the bin target to run,
 and `--example` specifies the example target to run. At most one of `--bin` or
 `--example` can be provided.
 
-All of the trailing arguments are passed to the binary to run. If you're passing
-arguments to both Cargo and the binary, the ones after `--` go to the binary,
-the ones before go to Cargo.
+All the arguments following the two dashes (`--`) are passed to the binary to
+run. If you're passing arguments to both Cargo and the binary, the ones after
+`--` go to the binary, the ones before go to Cargo.
 ",
         )
 }
index 93db6dccd953ba80446412c8efc001f7fade8810..35cab8762d2158a08ed21fa926c405d6e49a26ba 100644 (file)
@@ -45,11 +45,15 @@ pub fn cli() -> App {
         .arg_message_format()
         .after_help(
             "\
-All of the trailing arguments are passed to the test binaries generated for
-filtering tests and generally providing options configuring how they run. For
-example, this will run all tests with the name `foo` in their name:
-
-    cargo test foo
+The test filtering argument `TESTNAME` and all the arguments following the
+two dashes (`--`) are passed to the test binaries and thus to libtest
+(rustc's built in unit-test and micro-benchmarking framework).  If you're
+passing arguments to both Cargo and the binary, the ones after `--` go to the
+binary, the ones before go to Cargo.  For details about libtest's arguments see
+the output of `cargo test -- --help`.  As an example, this will run all
+tests with `foo` in their name on 3 threads in parallel:
+
+    cargo test foo -- --test-threads 3
 
 If the --package argument is given, then SPEC is a package id specification
 which indicates which package should be tested. If it is not given, then the