-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance documentation of testing #10726
Conversation
- Mention that in `src/` Cargo also collect doc tests. - Remove outdated statement: Cargo no longer tests examples by default. - Add a link to "Cargo Targets: Tests" to help people learn about it.
NOTE: This is an undocumented implementation details.
r? @ehuss (rust-highfive has picked a reviewer for you, use r? to override) |
Overall, looks like a good improvement. Addressing the wording tweak is all I see thats needed before merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
src/doc/man/cargo-bench.md
Outdated
the test harness to tell it to run only benchmarks. | ||
Benchmarks are built with the `--test` option to `rustc` which creates a | ||
special executable by linking your code with libtest. The executable | ||
automatically runs all functions annotated with the `#[test]` attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
automatically runs all functions annotated with the `#[test]` attribute. | |
automatically runs all functions annotated with `#[test]` and `#[bench]` attributes. |
I was slightly confused reading this due to the mention of #[test]
. I'm not sure if this is any clearer. This is delving into some low-level details that is mostly not relevant to the average user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Now I feel like mentioning #[bench]
is enough. I'll put it back then.
- Rephrase doctest exec model as "not guranteed and may change" instead - Mention `#[bench]` in what cargo-bench automatically runs - Make it clear for build/rustc when mentioning bin targets auto-built
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ehuss not merging this in case you want to look over the changes in response to your comments
This is too details and not for averaged users.
Thanks! I pushed a small wording tweak. @bors r=epage |
📌 Commit 5d33609 has been approved by |
☀️ Test successful - checks-actions |
Update cargo 7 commits in 38472bc19f2f76e245eba54a6e97ee6821b3c1db..85e457e158db216a2938d51bc3b617a5a7fe6015 2022-05-31 02:03:24 +0000 to 2022-06-07 21:57:52 +0000 - Make -Z http-registry use index.crates.io when accessing crates-io (rust-lang/cargo#10725) - Respect submodule update=none strategy in .gitmodules (rust-lang/cargo#10717) - Expose rust-version through env var (rust-lang/cargo#10713) - add validation for string "true"/"false" in lto profile (rust-lang/cargo#10676) - Enhance documentation of testing (rust-lang/cargo#10726) - Clear disk space on CI. (rust-lang/cargo#10724) - Enforce to use tar v0.4.38 (rust-lang/cargo#10720)
What does this PR try to resolve?
Enhance Cargo docs a bit on testing topic. Related issues:
How should we test and review this PR?
All changes are described in commit message.
You can build the doc and help proofread some of these pages:
Additional information
I am not sure whether we should include undocumented execution model of doctests, which is the last commit, though I added a warning pointing out this truth. I can drop it if anyone in the team disagrees.