-
Notifications
You must be signed in to change notification settings - Fork 5
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
Daniel/integration tests improvements #111
Conversation
Pulls regression fix
CI broke because GH-CI Rust was fetching the latest Clap beta. I fixed the new breaking changes and bumped the version. Everything is fine now. But some test cases arbitrarily fail on my machine from time to time. |
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.
Looks great to me!
We will do some later refinements, but this is a very good first step.
instead of taking a slice and checking equiality
Looks like integration tests are failing arbitrarily because sometimes Apalache spits stderr for an arbitrary standard module.
This only happens when multiple Apalache runtimes are executed in parallel. Although, the exit status stays alright. So, handle exit status codes (0, 12, 255) rather than stderr parsing? |
Also, the The problem comes from the race condition to take locks on {
let test_result = Arc::new(Mutex::new(TestResult::Unhandled));
let old_hook = panic::take_hook();
panic::set_hook({
let result = test_result.clone();
Box::new(move |info| {
let mut result = result.lock().unwrap();
let message = match info.payload().downcast_ref::<&'static str>() {
Some(&s) => s.to_string(),
None => match info.payload().downcast_ref::<String>() {
Some(s) => s.clone(),
None => "Unknown error".to_string(),
},
};
let location = match info.location() {
Some(l) => l.to_string(),
None => "".to_string(),
};
*result = TestResult::Failure { message, location };
})
});
let result = panic::catch_unwind(AssertUnwindSafe(|| test()));
panic::set_hook(old_hook);
match result {
Ok(res) => TestResult::Success(serde_json::to_string_pretty(&res).unwrap()),
Err(_) => (*test_result.lock().unwrap()).clone(),
}
} The code expects the lock from line 179 to happen before the lock from line 198. But it is not guaranteed. We can use something from |
I turned off the multi-threaded testing as last resort. I am merging this to We should refactor the testing framework 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.
Ready to merge.
An integration test 'framework' as per #106. I have a basic design.
In one(ish) sentence the design is
Features
Extras
Issues this closes