@@ -85,22 +85,62 @@ working on.
8585* [ Commit as you go] [ githelp ] .
8686* Include tests that cover all non-trivial code. The existing tests
8787in ` test/ ` provide templates on how to test Cargo's behavior in a
88- sandbox-environment. The internal module ` testsuite/ support` provides a vast amount
89- of helpers to minimize boilerplate. See [ ` testsuite/ support/mod .rs` ] for an
88+ sandbox-environment. The internal module ` crates/cargo-test- support` provides a vast amount
89+ of helpers to minimize boilerplate. See [ ` crates/cargo-test- support/src/lib .rs` ] for an
9090introduction 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.
9893* 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.
10196* Push your commits to GitHub and create a pull request against Cargo's
10297` master ` branch.
10398
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+
104144## Pull requests
105145
106146After 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.
124164
125165## Contributing to the documentation
126166
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.
139169
140170## Issue Triage
141171
@@ -184,6 +214,7 @@ adding labels to triage issues:
184214* The light orange ** relnotes** label marks issues that should be documented in
185215 the release notes of the next release.
186216
217+ * Dark blue, ** Z** -prefixed labels are for unstable, nightly features.
187218
188219[ githelp ] : https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html
189220[ development-models ] : https://help.github.com/articles/about-collaborative-development-models/
@@ -197,6 +228,6 @@ adding labels to triage issues:
197228[ I-nominated ] : https://github.com/rust-lang/cargo/labels/I-nominated
198229[ Code of Conduct ] : https://www.rust-lang.org/conduct.html
199230[ Discord ] : https://discordapp.com/invite/rust-lang
200- [ `testsuite/ support/mod .rs` ] : https://github.com/rust-lang/ cargo/blob/master/tests/testsuite/ support/mod .rs
231+ [ `crates/cargo-test- support/src/lib .rs` ] : crates/ cargo-test- support/src/lib .rs
201232[ irlo ] : https://internals.rust-lang.org/
202233[ subcommands ] : https://doc.rust-lang.org/cargo/reference/external-tools.html#custom-subcommands
0 commit comments