Skip to content

Commit

Permalink
Dawn validation test: fix EXPECT_DEPRECATION_WARNINGS
Browse files Browse the repository at this point in the history
This CL make EXPECT_DEPRECATION_WARNINGS macro not accessing the private
member mDawnInstance anymore, so that this macro can be used in test
implementation. Without this CL the macro can only used in member
functions of ValidationTest itself.

Bug: 349125474
Change-Id: I82e5a027ce6a8cc171358c5767a462e9518533a8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/206087
Reviewed-by: Corentin Wallez <[email protected]>
Commit-Queue: Corentin Wallez <[email protected]>
  • Loading branch information
jzm-intel authored and Dawn LUCI CQ committed Sep 12, 2024
1 parent 4d450d0 commit 37db223
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/dawn/tests/unittests/validation/ValidationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ dawn::utils::WireHelper* ValidationTest::GetWireHelper() const {
return mWireHelper.get();
}

uint64_t ValidationTest::GetInstanceDeprecationCountForTesting() {
return mDawnInstance->GetDeprecationWarningCountForTesting();
}

uint32_t ValidationTest::GetDeviceCreationDeprecationWarningExpectation(
const wgpu::DeviceDescriptor& descriptor) {
uint32_t expectedDeprecatedCount = 0;
Expand Down
21 changes: 11 additions & 10 deletions src/dawn/tests/unittests/validation/ValidationTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@
} \
} while (0)

#define EXPECT_DEPRECATION_WARNINGS(statement, n) \
do { \
FlushWire(); \
uint64_t warningsBefore = mDawnInstance->GetDeprecationWarningCountForTesting(); \
EXPECT_EQ(mLastWarningCount, warningsBefore); \
statement; \
FlushWire(); \
uint64_t warningsAfter = mDawnInstance->GetDeprecationWarningCountForTesting(); \
EXPECT_EQ(warningsAfter, warningsBefore + n); \
mLastWarningCount = warningsAfter; \
#define EXPECT_DEPRECATION_WARNINGS(statement, n) \
do { \
FlushWire(); \
uint64_t warningsBefore = GetInstanceDeprecationCountForTesting(); \
EXPECT_EQ(mLastWarningCount, warningsBefore); \
statement; \
FlushWire(); \
uint64_t warningsAfter = GetInstanceDeprecationCountForTesting(); \
EXPECT_EQ(warningsAfter, warningsBefore + n); \
mLastWarningCount = warningsAfter; \
} while (0)
#define EXPECT_DEPRECATION_WARNING(statement) EXPECT_DEPRECATION_WARNINGS(statement, 1)

Expand Down Expand Up @@ -180,6 +180,7 @@ class ValidationTest : public testing::Test {
void SetUp(const wgpu::InstanceDescriptor* nativeDesc,
const wgpu::InstanceDescriptor* wireDesc = nullptr);

uint64_t GetInstanceDeprecationCountForTesting();
// Helps compute expected deprecated warning count for creating device with given descriptor.
uint32_t GetDeviceCreationDeprecationWarningExpectation(
const wgpu::DeviceDescriptor& descriptor);
Expand Down

0 comments on commit 37db223

Please sign in to comment.