-
Notifications
You must be signed in to change notification settings - Fork 321
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
Support running miri in ci #534
Conversation
ci/test-miri.sh
Outdated
|
||
source ci/rust-version.sh nightly | ||
|
||
rustup component add miri --toolchain "$rust_nightly" |
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.
maybe, need to move to Dockerfile...
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.
that said, running this multiple times is harmless:
$ rustup component add miri --toolchain nightly-2024-01-05-x86_64-unknown-linux-gnu
info: component 'miri' for target 'x86_64-unknown-linux-gnu' is up to date
$ echo $?
0
so, i can move this line as a follow-up pr. once after mighty @yihau did update our rust dockers. :)
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.
yeah. should put into Dockerfile. could we have the Dockerfile changes in this PR?
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.
yeah, done: 2c370a6
ci/test-miri.sh
Outdated
|
||
source ci/rust-version.sh nightly | ||
|
||
rustup component add miri --toolchain "$rust_nightly" |
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.
yeah. should put into Dockerfile. could we have the Dockerfile changes in this PR?
rustup component add miri --toolchain "$rust_nightly" | ||
|
||
# miri is very slow; so only run very few of selective tests! | ||
cargo "+${rust_nightly}" miri test -p solana-program -- hash:: account_info:: |
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.
does the #[cfg_attr(miri)]
work for this purpose? (I'm not quite understand how it select tests. try to steal your brain 😂)
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.
that would need to add #[cfg_attr(miri, ignore)]
to almost all tests...
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.
updated the docker image and miri is green ✅
Wow, nicely done! I remember when I first started on the code base, one thing I tried to do initially was get miri running. I failed, so glad to see you succeed here! |
Problem
my
unsafe
is getting disputed (#129). :)Summary of Changes
after playing a bit, it turned out miri can detect many aliasing violations at runtime, which cann't be caught at compile-time.
So, to argue for my
unsafe
s, let's sneak inmiri
support into the ci...That said, I have yet another reason to use miri in my task queue. so, making using miri easy shouln't be wasted effort.
cc: @alessandrod @apfitzge