From 9138fe253b7c2d48b8b40f1de1365835b59abd3f Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Wed, 24 Mar 2021 19:39:33 +0000 Subject: [PATCH] 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 Auto-Submit: Ryan Harrison Reviewed-by: Corentin Wallez --- src/tests/end2end/ShaderTests.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tests/end2end/ShaderTests.cpp b/src/tests/end2end/ShaderTests.cpp index e54dc79119..1bcc02448d 100644 --- a/src/tests/end2end/ShaderTests.cpp +++ b/src/tests/end2end/ShaderTests.cpp @@ -86,6 +86,15 @@ TEST_P(ShaderTests, ComputeLog2) { 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, D3D12Backend(), MetalBackend(),