Print the failing statement in ASSERT_DEVICE_ERROR

Makes it easier to track where and why a test failed.

Bug: none
Change-Id: Icdccde97db68c32c35af6c044a3eacd4d4978b61
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19701
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2020-04-16 21:36:33 +00:00 committed by Commit Bot service account
parent 319672791e
commit 3aa5be9749
2 changed files with 17 additions and 9 deletions

View File

@ -59,11 +59,15 @@
// Should only be used to test validation of function that can't be tested by regular validation // Should only be used to test validation of function that can't be tested by regular validation
// tests; // tests;
#define ASSERT_DEVICE_ERROR(statement) \ #define ASSERT_DEVICE_ERROR(statement) \
StartExpectDeviceError(); \ StartExpectDeviceError(); \
statement; \ statement; \
FlushWire(); \ FlushWire(); \
ASSERT_TRUE(EndExpectDeviceError()) if (!EndExpectDeviceError()) { \
FAIL() << "Expected device error in:\n " << #statement; \
} \
do { \
} while (0)
struct RGBA8 { struct RGBA8 {
constexpr RGBA8() : RGBA8(0, 0, 0, 0) { constexpr RGBA8() : RGBA8(0, 0, 0, 0) {

View File

@ -19,10 +19,14 @@
#include "dawn_native/DawnNative.h" #include "dawn_native/DawnNative.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#define ASSERT_DEVICE_ERROR(statement) \ #define ASSERT_DEVICE_ERROR(statement) \
StartExpectDeviceError(); \ StartExpectDeviceError(); \
statement; \ statement; \
ASSERT_TRUE(EndExpectDeviceError()) if (!EndExpectDeviceError()) { \
FAIL() << "Expected device error in:\n " << #statement; \
} \
do { \
} while (0)
class ValidationTest : public testing::Test { class ValidationTest : public testing::Test {
public: public: