-
Notifications
You must be signed in to change notification settings - Fork 48
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
Use loom in the tests #34
Comments
I've been working on it, right now all the test pass except the |
I would love for us to also run the tests through miri! |
See also #37 |
Nice, however, when I run the test with miri and loom they don't produce
any output.
|
Interesting.. What do they produce? |
It just exits with 0
|
Hmm, I'm not sure -- @carllerche? Separately, I do not think we want to use |
I don't know anything about miri + loom :) seems rough to mix the two. I don't think miri supports threading. Also, correct re: Using loom right now is not friendly, if anyone is so inclined, we could definitely use some UX help :) |
Ah, @ZenTauro, were you trying to run both at the same time? Yeah, that probably won't work. I think we probably want to run the two independently. |
Yeah, I didn't know they were interfering
I'll put them behind |
I am trying to implement a macro that can annotate tests in order to run them with loom only if configured to do so. I am not really familiar with proc macros so I haven't been able to make a lot of progress, if someone is interested I'll appreciate some help in the implementation. |
I think the way to go is to require a compile-time |
The macro does that, it uses the #[test]
fn some_test() {
if cfg!(loom) {
loom::model(|| {
// test body
});
} else {
// test body
}
} We can write: #[test]
#[loom_macro::wrapper]
fn some_test() {
// test body
} |
I'm not sure we ever really want to write tests that way? Most commonly, loom tests are very tailor-written for loom to avoid too large a state space for it to explore. I don't know that we're likely to ever want to share a test between #[cfg(loom)]
mod loom_tests {
#[test]
fn custom_written_test_for_loom() { }
}
#[cfg(not(loom)]
mod non_loom_tests {
#[test]
regular_test() {}
} |
I've added initial support for |
Nice, I'll look into the patch
|
We could use loom to test multiple permutations in the tests.
The text was updated successfully, but these errors were encountered: