Take this test in vulkano:
#[test]
#[should_panic(expected = "Tried to submit a present command without any swapchain")]
fn no_swapchain_added() {
let (_, queue) = gfx_dev_and_queue!();
let _ = SubmitPresentBuilder::new().submit(&queue);
}
In this code we start by initializing a Vulkan device with the gfx_dev_and_queue!()
macro.
Then we try to submit a present command without any swapchain. Since doing so in invalid, the submit
function panics.
The test has a #[should_panic]
attribute that catches this situation and makes the test succeed.
This works on my local machine. Unfortunately when running this test on Travis, there is no Vulkan implementation available on the machine and the gfx_dev_and_queue!()
macro uses return
as a way to ignore the test (here, here or here).
While using return
to ignore a test works for regular tests, it doesn't work for tests with #[should_panic]
as it makes the test fail.
I know that there's no way to solve this problem in a clean way. However I'm wondering if people had suggestions for hacks to solve this without having to call panic!("Tried to submit a present command without any swapchain")
and more generally without having to copy-paste the panic message.
Thank you