From 619348135231d7632e4d93a643601e9642c38bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 1 Nov 2019 17:14:21 +0100 Subject: [PATCH] Don't panic in Offchain test context, when we are already panicking (#3996) --- substrate/core/offchain/src/testing.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/core/offchain/src/testing.rs b/substrate/core/offchain/src/testing.rs index e1cc7f71a3..3f4415efa7 100644 --- a/substrate/core/offchain/src/testing.rs +++ b/substrate/core/offchain/src/testing.rs @@ -119,7 +119,8 @@ impl State { impl Drop for State { fn drop(&mut self) { - if !self.expected_requests.is_empty() { + // If we panic! while we are already in a panic, the test dies with an illegal instruction. + if !self.expected_requests.is_empty() && !std::thread::panicking() { panic!("Unfulfilled expected requests: {:?}", self.expected_requests); } }