-
Notifications
You must be signed in to change notification settings - Fork 385
Automatically distinguish between Miri identifying UB and Miri being unable to run tests #1908
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
Comments
Perhaps that could be a flag named something like
|
I don't quite see how this could work. Note that Miri does not have a concept of 'tests'. When you run Rust tests with
When the program calls some foreign function, Miri has to do something. A NOP is not an option. It can make all functions return 0 and ignore their arguments, but I doubt that would lead to useful results...
That seems plausible. I do not know if anyone relies on the existing error codes, or how to determine useful error codes. Miri is basically a rustc backend; which error codes does rustc use? AFAIK, the error code 1 currently comes from this call Line 89 in 3f2c9ee
To make the error code dependent on the kind of error, we probably want to call Line 76 in 3f2c9ee
|
Yeah, that makes sense. In theory, Miri could abort with a zero exit code if that flag were passed, but that'd be worse than just always returning a special error code for unsupported operations. |
Makes sense, though I do think it'd be possible to have the libtest harness override its behavior when running in Miri if there were a way to communicate this info, maybe by using
No idea, though reportedly it's at least possible for it to return an error code other than 0 or 1: rust-lang/rust#51975. |
In general, rustc exits with 101 when it panics, just like regular Rust programs. |
Yes, we could establish some sort of interaction between Miri and the test harness. AFAIK this is already possible to some extend -- the test harness will catch the panic and continue evaluation, right? So it actually will continue running tests here, I think. See #1807 for the motivation that lead to The basic idea seems to be to pass |
@kupiakos I wonder if you had the chance to try out the proposals in my last comment? I think |
Hi, I'm working on an automated test suite for our project with Miri, and we have a number of crates that use FFI in some, but not all, tests. I won't have knowledge about which crates and the tests within those crates call FFI functions.
Is there an easy way to handle this? We want to run as many of our tests as possible under Miri. Right now, my current strategy is to go through stderr after running
cargo miri test
on each crate and search through a set of fixed error strings that indicate Miri being unable to run the test rather than identifying UB. However, that's brittle and requires me to know upfront all of the possible unsupported features.Could we have a different error code be returned for
cargo miri test
if a test was unable to finish running due to an unsupported feature? Right now both UB and unsupported features return1
.If there were a flag to skip and ignore tests that couldn't run in Miri, that would also work.
The text was updated successfully, but these errors were encountered: