Add test to confirm validation rejects invalid WGSL

BUG=dawn:504

Change-Id: If09b12d4df9c7aedcb28b4640557cc3cae6e989d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/45700
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Ryan Harrison 2021-03-24 19:39:33 +00:00 committed by Commit Bot service account
parent 60ca94ba10
commit 9138fe253b
1 changed files with 9 additions and 0 deletions

View File

@ -86,6 +86,15 @@ TEST_P(ShaderTests, ComputeLog2) {
EXPECT_BUFFER_U32_RANGE_EQ(expected.data(), buffer, 0, kSteps); EXPECT_BUFFER_U32_RANGE_EQ(expected.data(), buffer, 0, kSteps);
} }
TEST_P(ShaderTests, BadWGSL) {
DAWN_SKIP_TEST_IF(HasToggleEnabled("skip_validation"));
std::string shader = R"(
I am an invalid shader and should never pass validation!
})";
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, shader.c_str()));
}
DAWN_INSTANTIATE_TEST(ShaderTests, DAWN_INSTANTIATE_TEST(ShaderTests,
D3D12Backend(), D3D12Backend(),
MetalBackend(), MetalBackend(),