-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Honor runner configuration for sub-crates in workspaces #12147
Comments
We have some complicated and non-obvious logic for skipping certain tests when running cargo test from the root of the crate in CI, but then an explicit invocation from the libbpf-rs/ sub-directory attempting to run those skipped tests (now under sudo). Simplify the logic and hopefully make it somewhat more obvious by prefixing all tests that require root with `test_root_`. Note: this is a workaround for what I'd call a bug in Cargo. I opened rust-lang/cargo#12147 in the hopes that this will be addressed eventually (though I don't know how realistic that is). If we are still getting confusion even with this more explicit naming, we may want to consider moving (or copying) libbpf-rs's .cargo/ directory into the workspace root. Signed-off-by: Daniel Müller <deso@posteo.net>
Thanks for the report! It is known that it can be confusing that cargo uses the current directory to determine which configuration files to load. Closing as a duplicate of #2930, #9769, and #10098 (and possibly https://internals.rust-lang.org/t/proposal-move-some-cargo-config-settings-to-cargo-toml/13336). |
To add, |
Thanks for the pointers. I am happy to hear that this is being recognized as an issue and looked at! |
We have some complicated and non-obvious logic for skipping certain tests when running cargo test from the root of the crate in CI, but then an explicit invocation from the libbpf-rs/ sub-directory attempting to run those skipped tests (now under sudo). Simplify the logic and hopefully make it somewhat more obvious by prefixing all tests that require root with `test_sudo_`. Note: this is a workaround for what I'd call a bug in Cargo. I opened rust-lang/cargo#12147 in the hopes that this will be addressed eventually (though I don't know how realistic that is). If we are still getting confusion even with this more explicit naming, we may want to consider moving (or copying) libbpf-rs's .cargo/ directory into the workspace root. Signed-off-by: Daniel Müller <deso@posteo.net>
We have some complicated and non-obvious logic for skipping certain tests when running cargo test from the root of the crate in CI, but then an explicit invocation from the libbpf-rs/ sub-directory attempting to run those skipped tests (now under sudo). Simplify the logic and hopefully make it somewhat more obvious by prefixing all tests that require root with `test_sudo_`. Note: this is a workaround for what I'd call a bug in Cargo. I opened rust-lang/cargo#12147 in the hopes that this will be addressed eventually (though I don't know how realistic that is). If we are still getting confusion even with this more explicit naming, we may want to consider moving (or copying) libbpf-rs's .cargo/ directory into the workspace root. Signed-off-by: Daniel Müller <deso@posteo.net>
Problem
When I have a workspace and one of the crates defines a custom test runner, this test runner is not used when running
cargo test
from the workspace root, only when executing it from the sub-crate itself. E.g.,In some weird way this seems to be yet another instance of #8870 (which I am still battling...)
Proposed Solution
Please: honor the logical configuration for the respective crate for which tests are run.
In the example above, I expect
cargo test
to fail forcrate2
even if run from the workspace root.Notes
I classified this issue as a feature request because as per #8870 it can probably be argued that this is "by design" (and not a bug). Yet, this design is most certainly questionable, in my opinion.
The text was updated successfully, but these errors were encountered: