-
Notifications
You must be signed in to change notification settings - Fork 83
miri: integrate Bazel Miri tests in communication #370
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
Open
dcalavrezo-qorix
wants to merge
3
commits into
main
Choose a base branch
from
dcalavrezo_miri
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
First, thanks for the efforts - but I think we need to be here very, very careful.
I understand to a minor extend, that we have a fork of
rules_rustwithin S-CORE for QNX related patches. Anyhow, these patches should be integrated back into officalrules_rust. We really do not want to have a fork of rules_rust - and then even under the same name!So features like this, should be really merged into the offical
rules_rustand not into a mirror for patches!We do not want to split the contributing community around
rules_rust.Second, while I highly appreciate the effort put into enabling miri - and I also think it is a must - I doubt the technical solution. From history, we have integrated
pylintthe very same way as it was done in this PR and we have seen quite quickly that it is impractical.At the end we want to execute
mirifor all Rust related code and tests within the project.Enforcing copy and paste around by re-adding this new rule everywhere will be hard to maintain.
IMHO we need to go the similar way, as we go with C++ Sanitizers. This must be an build option, and then all tests are executed under this toolchain. Best would be, if we would even use the same build option as the one from C++...
--config=ubsanI have limited knowledge about ´miri´ and how it operates, so I am not sure if we would need another rule, or this can be injected at compile time. But if we would really need another rule, I would propose to look into
aspectsto avoid the manual creation of these rules.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.
Thanks for the feedback.
In parallel, we should absolutely try to upstream the
Miriintegration into officialrules_rust.I agree that this is the right long-term direction. Realistically, though, I expect this to take quite some time — likely many months, possibly around a year — because proper Miri support requires non-trivial changes.That said, I think we need to be careful with the assumption that
Mirican be enabled in the same way as C++ sanitizers via a global build option such as--config=ubsan.Miriis not just another compiler flag or sanitizer. It is a separate interpreter/executor for Rust programs. It also has important limitations, especially around FFI. Because of that, we cannot simply run it over the whole code base and all tests in the same way we run sanitizer-enabled C++ tests.This is also why the current implementation wraps existing
rust_testandrust_binarytargets instead of trying to inject Miri globally at compile time.Another important point: the official
Miridocumentation states that invoking theMiridriver directly is not a supported interface. Making this work in Bazel, while decoupling it from Cargo/cargo-miri and keeping it hermetic and reproducible, required quite some effort.There have also been several attempts in the
rules_rustcommunity to integrateMirisupport, but they were abandoned. So while I fully agree that upstream support is the ideal end state, I do not think we should block practical usage in S-CORE on that.Also, nobody is forced to integrate Miri targets everywhere immediately (
communicationincluded - you can just drop this PR). We can introduce them where they make sense and expand usage gradually, especially for Rust code that is suitable for Miri and does not depend on unsupported FFI behavior.