Skip to content

Commit af0fbf4

Browse files
committed
doc: mention cargo test runs test targets serially
1 parent 2c9cfd6 commit af0fbf4

File tree

8 files changed

+56
-40
lines changed

8 files changed

+56
-40
lines changed

src/doc/man/cargo-bench.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ similarly named benchmarks like `foobar`):
2828

2929
cargo bench -- foo --exact
3030

31-
Benchmarks are built with the `--test` option to `rustc` which creates an
32-
executable with a `main` function that automatically runs all functions
33-
annotated with the `#[bench]` attribute. Cargo passes the `--bench` flag to
34-
the test harness to tell it to run only benchmarks.
31+
Benchmarks are built with the `--test` option to `rustc` which creates a
32+
special executable by linking your code with libtest. The executable
33+
automatically runs all functions annotated with the `#[test]` attribute.
34+
Cargo passes the `--bench` flag to the test harness to tell it to run only
35+
benchmarks.
3536

3637
The libtest harness may be disabled by setting `harness = false` in the target
3738
manifest settings, in which case your code will need to provide its own `main`

src/doc/man/cargo-test.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cargo-test - Execute unit and integration tests of a package
1212

1313
## DESCRIPTION
1414

15-
Compile and execute unit and integration tests.
15+
Compile and execute unit, integration, and documentation tests.
1616

1717
The test filtering argument `TESTNAME` and all the arguments following the two
1818
dashes (`--`) are passed to the test binaries and thus to _libtest_ (rustc's
@@ -27,11 +27,14 @@ on 3 threads in parallel:
2727

2828
cargo test foo -- --test-threads 3
2929

30-
Tests are built with the `--test` option to `rustc` which creates an
31-
executable with a `main` function that automatically runs all functions
32-
annotated with the `#[test]` attribute in multiple threads. `#[bench]`
33-
annotated functions will also be run with one iteration to verify that they
34-
are functional.
30+
Tests are built with the `--test` option to `rustc` which creates a special
31+
executable by linking your code with libtest. The executable automatically
32+
runs all functions annotated with the `#[test]` attribute in multiple threads.
33+
`#[bench]` annotated functions will also be run with one iteration to verify
34+
that they are functional.
35+
36+
If the package contains multiple test targets, each target compiles to a
37+
special executable as aforementioned, and then is run serially.
3538

3639
The libtest harness may be disabled by setting `harness = false` in the target
3740
manifest settings, in which case your code will need to provide its own `main`

src/doc/man/generated_txt/cargo-bench.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ DESCRIPTION
2323

2424
cargo bench -- foo --exact
2525

26-
Benchmarks are built with the --test option to rustc which creates an
27-
executable with a main function that automatically runs all functions
28-
annotated with the #[bench] attribute. Cargo passes the --bench flag to
29-
the test harness to tell it to run only benchmarks.
26+
Benchmarks are built with the --test option to rustc which creates a
27+
special executable by linking your code with libtest. The executable
28+
automatically runs all functions annotated with the #[test] attribute.
29+
Cargo passes the --bench flag to the test harness to tell it to run only
30+
benchmarks.
3031

3132
The libtest harness may be disabled by setting harness = false in the
3233
target manifest settings, in which case your code will need to provide

src/doc/man/generated_txt/cargo-test.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SYNOPSIS
77
cargo test [options] [testname] [-- test-options]
88

99
DESCRIPTION
10-
Compile and execute unit and integration tests.
10+
Compile and execute unit, integration, and documentation tests.
1111

1212
The test filtering argument TESTNAME and all the arguments following the
1313
two dashes (--) are passed to the test binaries and thus to libtest
@@ -23,11 +23,14 @@ DESCRIPTION
2323

2424
cargo test foo -- --test-threads 3
2525

26-
Tests are built with the --test option to rustc which creates an
27-
executable with a main function that automatically runs all functions
28-
annotated with the #[test] attribute in multiple threads. #[bench]
29-
annotated functions will also be run with one iteration to verify that
30-
they are functional.
26+
Tests are built with the --test option to rustc which creates a special
27+
executable by linking your code with libtest. The executable
28+
automatically runs all functions annotated with the #[test] attribute in
29+
multiple threads. #[bench] annotated functions will also be run with one
30+
iteration to verify that they are functional.
31+
32+
If the package contains multiple test targets, each target compiles to a
33+
special executable as aforementioned, and then is run serially.
3134

3235
The libtest harness may be disabled by setting harness = false in the
3336
target manifest settings, in which case your code will need to provide

src/doc/src/commands/cargo-bench.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ similarly named benchmarks like `foobar`):
2828

2929
cargo bench -- foo --exact
3030

31-
Benchmarks are built with the `--test` option to `rustc` which creates an
32-
executable with a `main` function that automatically runs all functions
33-
annotated with the `#[bench]` attribute. Cargo passes the `--bench` flag to
34-
the test harness to tell it to run only benchmarks.
31+
Benchmarks are built with the `--test` option to `rustc` which creates a
32+
special executable by linking your code with libtest. The executable
33+
automatically runs all functions annotated with the `#[test]` attribute.
34+
Cargo passes the `--bench` flag to the test harness to tell it to run only
35+
benchmarks.
3536

3637
The libtest harness may be disabled by setting `harness = false` in the target
3738
manifest settings, in which case your code will need to provide its own `main`

src/doc/src/commands/cargo-test.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cargo-test - Execute unit and integration tests of a package
1212

1313
## DESCRIPTION
1414

15-
Compile and execute unit and integration tests.
15+
Compile and execute unit, integration, and documentation tests.
1616

1717
The test filtering argument `TESTNAME` and all the arguments following the two
1818
dashes (`--`) are passed to the test binaries and thus to _libtest_ (rustc's
@@ -27,11 +27,14 @@ on 3 threads in parallel:
2727

2828
cargo test foo -- --test-threads 3
2929

30-
Tests are built with the `--test` option to `rustc` which creates an
31-
executable with a `main` function that automatically runs all functions
32-
annotated with the `#[test]` attribute in multiple threads. `#[bench]`
33-
annotated functions will also be run with one iteration to verify that they
34-
are functional.
30+
Tests are built with the `--test` option to `rustc` which creates a special
31+
executable by linking your code with libtest. The executable automatically
32+
runs all functions annotated with the `#[test]` attribute in multiple threads.
33+
`#[bench]` annotated functions will also be run with one iteration to verify
34+
that they are functional.
35+
36+
If the package contains multiple test targets, each target compiles to a
37+
special executable as aforementioned, and then is run serially.
3538

3639
The libtest harness may be disabled by setting `harness = false` in the target
3740
manifest settings, in which case your code will need to provide its own `main`

src/etc/man/cargo-bench.1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ cargo bench \-\- foo \-\-exact
2828
.fi
2929
.RE
3030
.sp
31-
Benchmarks are built with the \fB\-\-test\fR option to \fBrustc\fR which creates an
32-
executable with a \fBmain\fR function that automatically runs all functions
33-
annotated with the \fB#[bench]\fR attribute. Cargo passes the \fB\-\-bench\fR flag to
34-
the test harness to tell it to run only benchmarks.
31+
Benchmarks are built with the \fB\-\-test\fR option to \fBrustc\fR which creates a
32+
special executable by linking your code with libtest. The executable
33+
automatically runs all functions annotated with the \fB#[test]\fR attribute.
34+
Cargo passes the \fB\-\-bench\fR flag to the test harness to tell it to run only
35+
benchmarks.
3536
.sp
3637
The libtest harness may be disabled by setting \fBharness = false\fR in the target
3738
manifest settings, in which case your code will need to provide its own \fBmain\fR

src/etc/man/cargo-test.1

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ cargo\-test \- Execute unit and integration tests of a package
88
.SH "SYNOPSIS"
99
\fBcargo test\fR [\fIoptions\fR] [\fItestname\fR] [\fB\-\-\fR \fItest\-options\fR]
1010
.SH "DESCRIPTION"
11-
Compile and execute unit and integration tests.
11+
Compile and execute unit, integration, and documentation tests.
1212
.sp
1313
The test filtering argument \fBTESTNAME\fR and all the arguments following the two
1414
dashes (\fB\-\-\fR) are passed to the test binaries and thus to \fIlibtest\fR (rustc's
@@ -27,11 +27,14 @@ cargo test foo \-\- \-\-test\-threads 3
2727
.fi
2828
.RE
2929
.sp
30-
Tests are built with the \fB\-\-test\fR option to \fBrustc\fR which creates an
31-
executable with a \fBmain\fR function that automatically runs all functions
32-
annotated with the \fB#[test]\fR attribute in multiple threads. \fB#[bench]\fR
33-
annotated functions will also be run with one iteration to verify that they
34-
are functional.
30+
Tests are built with the \fB\-\-test\fR option to \fBrustc\fR which creates a special
31+
executable by linking your code with libtest. The executable automatically
32+
runs all functions annotated with the \fB#[test]\fR attribute in multiple threads.
33+
\fB#[bench]\fR annotated functions will also be run with one iteration to verify
34+
that they are functional.
35+
.sp
36+
If the package contains multiple test targets, each target compiles to a
37+
special executable as aforementioned, and then is run serially.
3538
.sp
3639
The libtest harness may be disabled by setting \fBharness = false\fR in the target
3740
manifest settings, in which case your code will need to provide its own \fBmain\fR

0 commit comments

Comments
 (0)