@@ -88,19 +88,59 @@ in `test/` provide templates on how to test Cargo's behavior in a
88
88
sandbox-environment. The internal module ` crates/cargo-test-support ` provides a vast amount
89
89
of helpers to minimize boilerplate. See [ ` crates/cargo-test-support/src/lib.rs ` ] for an
90
90
introduction to writing tests.
91
- * Make sure ` cargo test ` passes. If you do not have the cross-compilers
92
- installed locally, install them using the instructions returned by
93
- ` cargo test cross_compile::cross_tests ` (twice, with ` --toolchain nightly `
94
- added to get the nightly cross target too); alternatively just
95
- ignore the cross-compile test failures or disable them by
96
- using ` CFG_DISABLE_CROSS_TESTS=1 cargo test ` . Note that some tests are enabled
97
- only on ` nightly ` toolchain. If you can, test both toolchains.
91
+ * Make sure ` cargo test ` passes. See [ Running tests] ( #running-tests ) below
92
+ for details on running tests.
98
93
* All code changes are expected to comply with the formatting suggested by ` rustfmt ` .
99
- You can use ` rustup component add --toolchain nightly rustfmt ` to install ` rustfmt ` and use
100
- ` rustfmt +nightly --unstable-features --skip-children ` on the changed files to automatically format your code.
94
+ You can use ` rustup component add rustfmt ` to install ` rustfmt ` and use
95
+ ` cargo fmt ` to automatically format your code.
101
96
* Push your commits to GitHub and create a pull request against Cargo's
102
97
` master ` branch.
103
98
99
+ ## Running tests
100
+
101
+ Most of the tests are found in the ` testsuite ` integration test. This can be
102
+ run with a simple ` cargo test ` .
103
+
104
+ Some tests only run on the nightly toolchain, and will be ignored on other
105
+ channels. It is recommended that you run tests with both nightly and stable to
106
+ ensure everything is working as expected.
107
+
108
+ Some tests exercise cross compiling to a different target. This will require
109
+ you to install the appropriate target. This typically is the 32-bit target of
110
+ your host platform. For example, if your host is a 64-bit
111
+ ` x86_64-unknown-linux-gnu ` , then you should install the 32-bit target with
112
+ ` rustup target add i686-unknown-linux-gnu ` . If you don't have the alternate
113
+ target installed, there should be an error message telling you what to do. You
114
+ may also need to install additional tools for the target. For example, on Ubuntu
115
+ you should install the ` gcc-multilib ` package.
116
+
117
+ If you can't install an alternate target, you can set the
118
+ ` CFG_DISABLE_CROSS_TESTS=1 ` environment variable to disable these tests.
119
+ Unfortunately 32-bit support on macOS is going away, so you may not be able to
120
+ run these tests on macOS. The Windows cross tests only support the MSVC
121
+ toolchain.
122
+
123
+ Some of the nightly tests require the ` rustc-dev ` component installed. This
124
+ component includes the compiler as a library. This may already be installed
125
+ with your nightly toolchain, but it if isn't, run `rustup component add
126
+ rustc-dev --toolchain=nightly`.
127
+
128
+ There are several other packages in the repo for running specialized tests,
129
+ and you will need to run these tests separately by changing into its directory
130
+ and running ` cargo test ` :
131
+
132
+ * [ ` crates/resolver-tests ` ] – This package runs tests on the dependency resolver.
133
+ * [ ` crates/cargo-platform ` ] – This is a standalone ` cfg() ` expression parser.
134
+
135
+ The ` build-std ` tests are disabled by default, but you can run them by setting
136
+ the ` CARGO_RUN_BUILD_STD_TESTS=1 ` environment variable and running `cargo test
137
+ --test build-std`. This requires the nightly channel, and also requires the
138
+ ` rust-src ` component installed with `rustup component add rust-src
139
+ --toolchain=nightly`.
140
+
141
+ [ `crates/resolver-tests` ] : crates/resolver-tests
142
+ [ `crates/cargo-platform` ] : crates/cargo-platform
143
+
104
144
## Pull requests
105
145
106
146
After the pull request is made, a friendly bot will automatically assign a
@@ -124,18 +164,8 @@ and [merges][mergequeue] it into Cargo's `master` branch.
124
164
125
165
## Contributing to the documentation
126
166
127
- To contribute to the documentation, all you need to do is change the markdown
128
- files in the ` src/doc ` directory. To view the rendered version of changes you
129
- have made locally, make sure you have ` mdbook ` installed and run:
130
-
131
- ``` sh
132
- cd src/doc
133
- mdbook build
134
- open book/index.html
135
- ```
136
-
137
- To install ` mdbook ` run ` cargo install mdbook ` .
138
-
167
+ See the [ documentation README] ( src/doc/README.md ) for details on building the
168
+ documentation.
139
169
140
170
## Issue Triage
141
171
@@ -184,6 +214,7 @@ adding labels to triage issues:
184
214
* The light orange ** relnotes** label marks issues that should be documented in
185
215
the release notes of the next release.
186
216
217
+ * Dark blue, ** Z** -prefixed labels are for unstable, nightly features.
187
218
188
219
[ githelp ] : https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html
189
220
[ development-models ] : https://help.github.com/articles/about-collaborative-development-models/
@@ -197,6 +228,6 @@ adding labels to triage issues:
197
228
[ I-nominated ] : https://github.com/rust-lang/cargo/labels/I-nominated
198
229
[ Code of Conduct ] : https://www.rust-lang.org/conduct.html
199
230
[ Discord ] : https://discordapp.com/invite/rust-lang
200
- [ `crates/cargo-test-support/src/lib.rs` ] : https://github.com/rust-lang/cargo/blob/master/ crates/cargo-test-support/src/lib.rs
231
+ [ `crates/cargo-test-support/src/lib.rs` ] : crates/cargo-test-support/src/lib.rs
201
232
[ irlo ] : https://internals.rust-lang.org/
202
233
[ subcommands ] : https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands
0 commit comments