#[ntest::timeout()] takes control of main thread away from the test
I'm running some unharnessed integration tests on a GUI that look like this
#[ntest::timeout(1000)]
fn main(){
launch_gui(); // panics if not run on the main thread
}
Right now, the way that timeout is implemented, my test always panics because the body of my test is run inside a spawned thread and not the main thread.
I understand that it may be impossible to satisfy my requirements because if the timer is on a spawned thread and panics it won't impact the main thread, so we can't merely reverse the roles here.
A potential workaround is to call std::process::exit(1) from the spawned thread, but killing the process prevents any remaining tests from running.
Additional context
- I'm using Dioxus as the GUI that requires the main thread
Even if my problem cannot be solved, it may be useful to leave this post here as documentation for others.