File tree Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,14 @@ ignore the `test` flag and will always test the given target.
7474Doc tests for libraries may be disabled by setting `doctest = false` for the
7575library in the manifest.
7676
77+ Binary targets are automatically built if there is an integration test or
78+ benchmark. This allows an integration test to execute the binary to exercise
79+ and test its behavior. The `CARGO_BIN_EXE_<name>`
80+ linkcargo:reference/environment-variables.html#environment-variables-cargo-sets-for-crates[environment variable]
81+ is set when the integration test is built so that it can use the
82+ link:https://doc.rust-lang.org/std/macro.env.html[`env` macro] to locate the
83+ executable.
84+
7785include::options-targets.adoc[]
7886
7987*--doc*::
Original file line number Diff line number Diff line change @@ -154,6 +154,15 @@ <h3 id="cargo_test_target_selection">Target Selection</h3>
154154library in the manifest.</ p >
155155</ div >
156156< div class ="paragraph ">
157+ < p > Binary targets are automatically built if there is an integration test or
158+ benchmark. This allows an integration test to execute the binary to exercise
159+ and test its behavior. The < code > CARGO_BIN_EXE_<name></ code >
160+ < a href ="../reference/environment-variables.html#environment-variables-cargo-sets-for-crates "> environment variable</ a >
161+ is set when the integration test is built so that it can use the
162+ < a href ="https://doc.rust-lang.org/std/macro.env.html "> < code > env</ code > macro</ a > to locate the
163+ executable.</ p >
164+ </ div >
165+ < div class ="paragraph ">
157166< p > Passing target selection flags will test only the
158167specified targets.</ p >
159168</ div >
Original file line number Diff line number Diff line change @@ -123,6 +123,15 @@ modules. The libtest harness will automatically find all of the `#[test]`
123123annotated functions and run them in parallel. You can pass module names to
124124[ ` cargo test ` ] to only run the tests within that module.
125125
126+ Binary targets are automatically built if there is an integration test. This
127+ allows an integration test to execute the binary to exercise and test its
128+ behavior. The ` CARGO_BIN_EXE_<name> ` [ environment variable] is set when the
129+ integration test is built so that it can use the [ ` env ` macro] to locate the
130+ executable.
131+
132+ [ environment variable ] : environment-variables.md#environment-variables-cargo-sets-for-crates
133+ [ `env` macro ] : ../../std/macro.env.html
134+
126135### Benchmarks
127136
128137Benchmarks provide a way to test the performance of your code using the
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ let version = env!("CARGO_PKG_VERSION");
195195 Binaries are automatically built when the test is built, unless the binary
196196 has required features that are not enabled.
197197
198- [ integration test ] : manifest .md#integration-tests
198+ [ integration test ] : cargo-targets .md#integration-tests
199199[ `env` macro ] : ../../std/macro.env.html
200200
201201#### Dynamic library paths
Original file line number Diff line number Diff line change 22.\" Title: cargo-test
33.\" Author: [see the "AUTHOR(S)" section]
44.\" Generator: Asciidoctor 2.0.10
5- .\" Date: 2020-01-18
5+ .\" Date: 2020-02-06
66.\" Manual: \ \&
77.\" Source: \ \&
88.\" Language: English
99.\"
10- .TH "CARGO\- TEST" "1" "2020-01-18 " "\ \& " "\ \& "
10+ .TH "CARGO\- TEST" "1" "2020-02-06 " "\ \& " "\ \& "
1111.ie \n( .g .ds Aq \(aq
1212.el .ds Aq '
1313.ss \n[ .ss ] 0
@@ -206,6 +206,16 @@ ignore the \fBtest\fP flag and will always test the given target.
206206Doc tests for libraries may be disabled by setting \fB doctest = false \fP for the
207207library in the manifest.
208208.sp
209+ Binary targets are automatically built if there is an integration test or
210+ benchmark. This allows an integration test to execute the binary to exercise
211+ and test its behavior. The \fB CARGO_BIN_EXE_<name> \fP
212+ \c
213+ .URL " https://doc.rust\- lang.org/cargo/reference/environment\- variables.html#environment\- variables\- cargo\- sets\- for\- crates" " environment variable"
214+ is set when the integration test is built so that it can use the
215+ .URL " https://doc.rust\- lang.org/std/macro.env.html" " \fB env \fP macro" " "
216+ to locate the
217+ executable.
218+ .sp
209219Passing target selection flags will test only the
210220specified targets.
211221.sp
You can’t perform that action at this time.
0 commit comments