From 24fdbf9ec8221ef6766c5e6888e3c385d64268c2 Mon Sep 17 00:00:00 2001 From: David Neto Date: Fri, 7 May 2021 22:22:34 +0000 Subject: [PATCH] spirv-reader: named type tests are deliberately invalid SPIR-V Bug: tint:765 Change-Id: I1a1a6fb6eef3fe7d0d7fbe5e6ce819ae89978f3f Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50022 Kokoro: Kokoro Commit-Queue: David Neto Reviewed-by: Alan Baker --- src/reader/spirv/parser_impl_named_types_test.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/reader/spirv/parser_impl_named_types_test.cc b/src/reader/spirv/parser_impl_named_types_test.cc index 236693911e..bdaadc66b7 100644 --- a/src/reader/spirv/parser_impl_named_types_test.cc +++ b/src/reader/spirv/parser_impl_named_types_test.cc @@ -30,6 +30,8 @@ TEST_F(SpvParserTest, NamedTypes_AnonStruct) { )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->program().to_str(), HasSubstr("Struct S")); + + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserTest, NamedTypes_NamedStruct) { @@ -40,6 +42,8 @@ TEST_F(SpvParserTest, NamedTypes_NamedStruct) { )")); EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->program().to_str(), HasSubstr("Struct mystruct")); + + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) { @@ -57,6 +61,8 @@ TEST_F(SpvParserTest, NamedTypes_Dup_EmitBoth) { StructMember{field0: __u32} StructMember{field1: __u32} })")); + + p->DeliberatelyInvalidSpirv(); } // TODO(dneto): Should we make an alias for an un-decoratrd array with @@ -72,6 +78,8 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArrayWithDecoration) { EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->program().to_str(), HasSubstr("RTArr -> __array__u32_stride_8\n")); + + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) { @@ -86,6 +94,8 @@ TEST_F(SpvParserTest, NamedTypes_AnonRTArray_Dup_EmitBoth) { EXPECT_THAT(p->program().to_str(), HasSubstr("RTArr -> __array__u32_stride_8\n RTArr_1 -> " "__array__u32_stride_8\n")); + + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserTest, NamedTypes_NamedRTArray) { @@ -98,6 +108,8 @@ TEST_F(SpvParserTest, NamedTypes_NamedRTArray) { EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->program().to_str(), HasSubstr("myrtarr -> __array__u32_stride_8\n")); + + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserTest, NamedTypes_NamedArray) { @@ -112,6 +124,8 @@ TEST_F(SpvParserTest, NamedTypes_NamedArray) { EXPECT_TRUE(p->BuildAndParseInternalModule()); EXPECT_THAT(p->program().to_str(), HasSubstr("myarr -> __array__u32_5_stride_8")); + + p->DeliberatelyInvalidSpirv(); } TEST_F(SpvParserTest, NamedTypes_AnonArray_Dup_EmitBoth) { @@ -127,6 +141,8 @@ TEST_F(SpvParserTest, NamedTypes_AnonArray_Dup_EmitBoth) { EXPECT_THAT(p->program().to_str(), HasSubstr("Arr -> __array__u32_5_stride_8\n Arr_1 -> " "__array__u32_5_stride_8")); + + p->DeliberatelyInvalidSpirv(); } // TODO(dneto): Handle arrays sized by a spec constant.