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 <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index fd5b700..80d2b99 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -892,7 +892,10 @@
}
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,