Skip to content

Commit 43cc409

Browse files
KangzDawn LUCI CQ
authored andcommitted
[dawn][tests] Allow using ASSERT_DEVICE_ERROR in helper functions
In ValidationTest, ASSERT_DEVICE_ERROR used GTest's FAIL() macro which immediately returns and prevents usage of it in helper functions that return a value. Instead use ADD_FAILURE that doesn't cause an early return. Bug: 463925499 Change-Id: I0311509e9c3a42ca97b9bfc45f3975880c33b31b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/280895 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
1 parent 17a47df commit 43cc409

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/dawn/tests/unittests/validation/ValidationTest.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,26 @@
6161
UNIMPLEMENTED_MACRO)) \
6262
(__VA_ARGS__)
6363

64-
#define ASSERT_DEVICE_ERROR_IMPL_1_(statement) \
65-
StartExpectDeviceError(); \
66-
statement; \
67-
device.Tick(); \
68-
FlushWire(); \
69-
if (!EndExpectDeviceError()) { \
70-
FAIL() << "Expected device error in:\n " << #statement; \
71-
} \
72-
do { \
64+
#define ASSERT_DEVICE_ERROR_IMPL_1_(statement) \
65+
StartExpectDeviceError(); \
66+
statement; \
67+
device.Tick(); \
68+
FlushWire(); \
69+
if (!EndExpectDeviceError()) { \
70+
ADD_FAILURE() << "Expected device error in:\n " << #statement; \
71+
} \
72+
do { \
7373
} while (0)
7474

75-
#define ASSERT_DEVICE_ERROR_IMPL_2_(statement, matcher) \
76-
StartExpectDeviceError(matcher); \
77-
statement; \
78-
device.Tick(); \
79-
FlushWire(); \
80-
if (!EndExpectDeviceError()) { \
81-
FAIL() << "Expected device error in:\n " << #statement; \
82-
} \
83-
do { \
75+
#define ASSERT_DEVICE_ERROR_IMPL_2_(statement, matcher) \
76+
StartExpectDeviceError(matcher); \
77+
statement; \
78+
device.Tick(); \
79+
FlushWire(); \
80+
if (!EndExpectDeviceError()) { \
81+
ADD_FAILURE() << "Expected device error in:\n " << #statement; \
82+
} \
83+
do { \
8484
} while (0)
8585

8686
// Skip a test when the given condition is satisfied.

0 commit comments

Comments
 (0)