From 101a5829d50f9509d514a13d49946a99c8f1c469 Mon Sep 17 00:00:00 2001 From: Enrico Galli Date: Sat, 8 Aug 2020 01:05:59 +0000 Subject: [PATCH] DawnTest: Prevent infinite loops in DawnTest. WaitABit waits forever should a device loss occurs, which happens when a bug is introduced. This can lock up the console preventing debugging when needed the most. Bug: dawn:495 Change-Id: I0b13ddfa75abbb9c43f7dd545fa9c41be79a697c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25960 Reviewed-by: Bryan Bernhart Reviewed-by: Austin Eng Commit-Queue: Bryan Bernhart --- src/tests/DawnTest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index fd5b7006f6..80d2b9940f 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -892,7 +892,10 @@ void DawnTestBase::OnDeviceError(WGPUErrorType type, const char* message, void* } void DawnTestBase::OnDeviceLost(const char* message, void* userdata) { - FAIL() << "Device Lost during test: " << message; + // Using ADD_FAILURE + ASSERT instead of FAIL to prevent the current test from continuing with a + // corrupt state. + ADD_FAILURE() << "Device Lost during test: " << message; + ASSERT(false); } std::ostringstream& DawnTestBase::AddBufferExpectation(const char* file,