-
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
do not compile test for bins flagged as test = false
#10305
Conversation
This behavior is not correct should be fixed. Update this test only for pointing out the current behavior.
Binaries without `test = false` are included by default, so no need to explicitly compile all binaries.
(rust-highfive has picked a reviewer for you, use r? to override) |
Thanks for this! As I read this though I'm sort of confused and wondering if you can help. Why is this filter reset given a test name to run? I would naively expect that by passing in a test name that doesn't affect the filter of what to or not to build at all and the test name is simply passed to all binaries which are built anyway |
IIUC, examples are included with the default target filter, but #6683 (comment) tried to avoid build examples if cargo/src/cargo/ops/cargo_compile.rs Lines 1417 to 1420 in 95bb3c9
I also feel a bit confused and unease when seeing this inconsistency. Though I should admit that it's somehow reasonable since cargo actually doesn't run any unittest in example with default target filter. If one passes in a test name without specifying target, the intent is quite straightforward that they wants to filter tests against default targets. Thus cargo can happily skip compiling examples. |
Perhaps a better way to organize this would be to have a method on |
Oops. The PR evolves to a refactoring. 🙇🏾♂️ Is 9138c35 in a more targeted fashion as you expect? |
@bors: r+ Seems reasonable to me! |
📌 Commit 2f5b303 has been approved by |
☀️ Test successful - checks-actions |
Update cargo 9 commits in 95bb3c92bf516017e812e7f1c14c2dea3845b30e..1c034752de0df744fcd7788fcbca158830b8bf85 2022-01-18 17:39:35 +0000 to 2022-01-25 22:36:53 +0000 - Sync toml_edit versions (rust-lang/cargo#10329) - Check --config for dotted keys only (rust-lang/cargo#10176) - Remove deprecated --host arg for search and publish cmds (rust-lang/cargo#10327) - doc: it's valid to use OUT_DIR for intermediate artifacts (rust-lang/cargo#10326) - Use local git info for version. (rust-lang/cargo#10323) - Fix documenting with undocumented dependencies. (rust-lang/cargo#10324) - do not compile test for bins flagged as `test = false` (rust-lang/cargo#10305) - Port cargo from toml-rs to toml_edit (rust-lang/cargo#10086) - Fix new::git_default_branch with different default (rust-lang/cargo#10306)
What does this PR try to resolve?
Fixes #10268
#6683 introduced a behavior that compiles all bin targets, but for bins with
test = false
they shouldn't be compiled with--test
as testbins.How should we test and review this PR?
In the first commit of this PR, I refines the test
test_filtered_excludes_compiling_examples
to reflect the current wrong behavior (test passed). The following two commits correct the behavior and the test accordingly. The last few commits encapsulate scattered target selection logic into functions onCompileFilter
.