[llvm] 76fca14 - [NFC] Update DXContainer tests to use fake parts
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 11:19:31 PST 2022
Author: Chris Bieneman
Date: 2022-12-09T13:16:49-06:00
New Revision: 76fca14750e3ca536e9b65a99ed55730cd704403
URL: https://github.com/llvm/llvm-project/commit/76fca14750e3ca536e9b65a99ed55730cd704403
DIFF: https://github.com/llvm/llvm-project/commit/76fca14750e3ca536e9b65a99ed55730cd704403.diff
LOG: [NFC] Update DXContainer tests to use fake parts
The tests that are focused on testing the file structure should use
fake part names so that the errors get triggered consistently. As we
add parsing support for known data types and structures under the parts
the parsing errors change to be more semantically accurate.
This change ensures the general errors continue to work with less churn
on the test cases in the future.
Added:
Modified:
llvm/test/tools/obj2yaml/DXContainer/DXILPart.yaml
llvm/test/tools/obj2yaml/DXContainer/ExplicitSizeAndOffsets.yaml
llvm/test/tools/obj2yaml/DXContainer/InvalidOffset.yaml
llvm/test/tools/obj2yaml/DXContainer/InvalidSize.yaml
llvm/test/tools/obj2yaml/DXContainer/OmitSizeAndOffsets.yaml
llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
llvm/unittests/Object/DXContainerTest.cpp
llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/obj2yaml/DXContainer/DXILPart.yaml b/llvm/test/tools/obj2yaml/DXContainer/DXILPart.yaml
index 4ee8c4282611b..58508f2dcc1e4 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/DXILPart.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/DXILPart.yaml
@@ -15,17 +15,17 @@ Header:
PartCount: 7
PartOffsets: [ 60, 76, 92, 108, 236, 1932, 1960 ]
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 8
- - Name: ISG1
+ - Name: FKE1
Size: 8
- - Name: OSG1
+ - Name: FKE2
Size: 8
- - Name: PSV0
+ - Name: FKE3
Size: 120
- - Name: STAT
+ - Name: FKE4
Size: 1688
- - Name: HASH
+ - Name: FKE5
Size: 20
- Name: DXIL
Size: 28
diff --git a/llvm/test/tools/obj2yaml/DXContainer/ExplicitSizeAndOffsets.yaml b/llvm/test/tools/obj2yaml/DXContainer/ExplicitSizeAndOffsets.yaml
index 040aeb014fd87..5d28866cb8a02 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/ExplicitSizeAndOffsets.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/ExplicitSizeAndOffsets.yaml
@@ -11,19 +11,19 @@ Header:
PartCount: 7
PartOffsets: [ 60, 76, 92, 108, 124, 140, 168 ]
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 8
- - Name: ISG1
+ - Name: FKE1
Size: 8
- - Name: OSG1
+ - Name: FKE2
Size: 8
- - Name: PSV0
+ - Name: FKE3
Size: 8
- - Name: STAT
+ - Name: FKE4
Size: 8
- - Name: HASH
+ - Name: FKE5
Size: 20
- - Name: CXIL
+ - Name: FKE6
Size: 8
...
@@ -38,18 +38,18 @@ Parts:
# CHECK-NEXT: PartCount: 7
# CHECK-NEXT: PartOffsets: [ 60, 76, 92, 108, 124, 140, 168 ]
# CHECK-NEXT: Parts:
-# CHECK-NEXT: - Name: SFI0
+# CHECK-NEXT: - Name: FKE0
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: ISG1
+# CHECK-NEXT: - Name: FKE1
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: OSG1
+# CHECK-NEXT: - Name: FKE2
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: PSV0
+# CHECK-NEXT: - Name: FKE3
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: STAT
+# CHECK-NEXT: - Name: FKE4
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: HASH
+# CHECK-NEXT: - Name: FKE5
# CHECK-NEXT: Size: 20
-# CHECK-NEXT: - Name: CXIL
+# CHECK-NEXT: - Name: FKE6
# CHECK-NEXT: Size: 8
# CHECK-NEXT: ...
diff --git a/llvm/test/tools/obj2yaml/DXContainer/InvalidOffset.yaml b/llvm/test/tools/obj2yaml/DXContainer/InvalidOffset.yaml
index b7e25e433e837..0ba4980a50b29 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/InvalidOffset.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/InvalidOffset.yaml
@@ -12,6 +12,6 @@ Header:
PartCount: 1
PartOffsets: [ 0 ]
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 8
...
diff --git a/llvm/test/tools/obj2yaml/DXContainer/InvalidSize.yaml b/llvm/test/tools/obj2yaml/DXContainer/InvalidSize.yaml
index e79aa4cb2ef87..0dd067ccf437b 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/InvalidSize.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/InvalidSize.yaml
@@ -11,8 +11,8 @@ Header:
FileSize: 64
PartCount: 2
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 8
- - Name: ISG1
+ - Name: FKE1
Size: 8
...
diff --git a/llvm/test/tools/obj2yaml/DXContainer/OmitSizeAndOffsets.yaml b/llvm/test/tools/obj2yaml/DXContainer/OmitSizeAndOffsets.yaml
index 62efd413533c1..fae268fd3dda7 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/OmitSizeAndOffsets.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/OmitSizeAndOffsets.yaml
@@ -9,19 +9,19 @@ Header:
Minor: 0
PartCount: 7
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 8
- - Name: ISG1
+ - Name: FKE1
Size: 8
- - Name: OSG1
+ - Name: FKE2
Size: 8
- - Name: PSV0
+ - Name: FKE3
Size: 8
- - Name: STAT
+ - Name: FKE4
Size: 8
- - Name: HASH
+ - Name: FKE5
Size: 20
- - Name: CXIL
+ - Name: FKE6
Size: 8
...
@@ -36,18 +36,18 @@ Parts:
# CHECK-NEXT: PartCount: 7
# CHECK-NEXT: PartOffsets: [ 60, 76, 92, 108, 124, 140, 168 ]
# CHECK-NEXT: Parts:
-# CHECK-NEXT: - Name: SFI0
+# CHECK-NEXT: - Name: FKE0
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: ISG1
+# CHECK-NEXT: - Name: FKE1
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: OSG1
+# CHECK-NEXT: - Name: FKE2
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: PSV0
+# CHECK-NEXT: - Name: FKE3
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: STAT
+# CHECK-NEXT: - Name: FKE4
# CHECK-NEXT: Size: 8
-# CHECK-NEXT: - Name: HASH
+# CHECK-NEXT: - Name: FKE5
# CHECK-NEXT: Size: 20
-# CHECK-NEXT: - Name: CXIL
+# CHECK-NEXT: - Name: FKE6
# CHECK-NEXT: Size: 8
# CHECK-NEXT: ...
diff --git a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
index 2a5a3ff9cd2a3..165b397c14577 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlags.yaml
@@ -8,7 +8,7 @@ Header:
Version:
Major: 1
Minor: 0
- PartCount: 7
+ PartCount: 2
Parts:
- Name: SFI0
Size: 8
@@ -45,17 +45,7 @@ Parts:
AdvancedTextureOps: true
WriteableMSAATextures: false
NextUnusedBit: true
- - Name: ISG1
- Size: 8
- - Name: OSG1
- Size: 8
- - Name: PSV0
- Size: 8
- - Name: STAT
- Size: 8
- - Name: HASH
- Size: 20
- - Name: CXIL
+ - Name: FKE0
Size: 8
...
diff --git a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
index ef73eb829157b..086c7e90dcd5f 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/ShaderFlagsEmpty.yaml
@@ -7,7 +7,7 @@ Header:
Version:
Major: 1
Minor: 0
- PartCount: 7
+ PartCount: 2
Parts:
- Name: SFI0
Size: 8
@@ -44,17 +44,7 @@ Parts:
AdvancedTextureOps: false
WriteableMSAATextures: false
NextUnusedBit: false
- - Name: ISG1
- Size: 8
- - Name: OSG1
- Size: 8
- - Name: PSV0
- Size: 8
- - Name: STAT
- Size: 8
- - Name: HASH
- Size: 20
- - Name: CXIL
+ - Name: FKE0
Size: 8
...
@@ -62,4 +52,4 @@ Parts:
# CHECK-NEXT: - Name: SFI0
# CHECK-NEXT: Size: 8
# CHECK-NOT: Flags:
-# CHECK-NEXT: - Name: ISG1
+# CHECK-NEXT: - Name: FKE0
diff --git a/llvm/unittests/Object/DXContainerTest.cpp b/llvm/unittests/Object/DXContainerTest.cpp
index 14fb4b82d7c58..4145ed66f813d 100644
--- a/llvm/unittests/Object/DXContainerTest.cpp
+++ b/llvm/unittests/Object/DXContainerTest.cpp
@@ -88,11 +88,11 @@ TEST(DXCFile, ParseEmptyParts) {
0x70, 0x0D, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x44, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
0x5C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
- 0x53, 0x46, 0x49, 0x30, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0x50, 0x53, 0x56, 0x30, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54,
- 0x00, 0x00, 0x00, 0x00, 0x43, 0x58, 0x49, 0x4C, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x45, 0x41, 0x44, 0x00, 0x00, 0x00, 0x00,
+ 0x46, 0x4B, 0x45, 0x30, 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x32, 0x00, 0x00, 0x00, 0x00,
+ 0x46, 0x4B, 0x45, 0x33, 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x35, 0x00, 0x00, 0x00, 0x00,
+ 0x46, 0x4B, 0x45, 0x36, 0x00, 0x00, 0x00, 0x00,
};
DXContainer C =
llvm::cantFail(DXContainer::create(getMemoryBuffer<116>(Buffer)));
@@ -108,21 +108,23 @@ TEST(DXCFile, ParseEmptyParts) {
EXPECT_EQ(ElementsVisited, 7);
{
+ // These are all intended to be fake part names so that the parser doesn't
+ // try to parse the part data.
auto It = C.begin();
- EXPECT_TRUE(memcmp(It->Part.Name, "SFI0", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE0", 4) == 0);
++It;
- EXPECT_TRUE(memcmp(It->Part.Name, "ISG1", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE1", 4) == 0);
++It;
- EXPECT_TRUE(memcmp(It->Part.Name, "OSG1", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE2", 4) == 0);
++It;
- EXPECT_TRUE(memcmp(It->Part.Name, "PSV0", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE3", 4) == 0);
++It;
- EXPECT_TRUE(memcmp(It->Part.Name, "STAT", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE4", 4) == 0);
++It;
- EXPECT_TRUE(memcmp(It->Part.Name, "CXIL", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE5", 4) == 0);
++It;
- EXPECT_TRUE(memcmp(It->Part.Name, "DEAD", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE6", 4) == 0);
++It; // Don't increment past the end
- EXPECT_TRUE(memcmp(It->Part.Name, "DEAD", 4) == 0);
+ EXPECT_TRUE(memcmp(It->Part.Name, "FKE6", 4) == 0);
}
}
diff --git a/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp b/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp
index 4055222ab6839..d4232295c8584 100644
--- a/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp
+++ b/llvm/unittests/ObjectYAML/DXContainerYAMLTest.cpp
@@ -40,19 +40,19 @@ TEST(DXCFile, ParseEmptyParts) {
PartCount: 7
PartOffsets: [ 60, 68, 76, 84, 92, 100, 108 ]
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 0
- - Name: ISG1
+ - Name: FKE1
Size: 0
- - Name: OSG1
+ - Name: FKE2
Size: 0
- - Name: PSV0
+ - Name: FKE3
Size: 0
- - Name: STAT
+ - Name: FKE4
Size: 0
- - Name: DXIL
+ - Name: FKE5
Size: 0
- - Name: DEAD
+ - Name: FKE6
Size: 0
...
)"));
@@ -64,11 +64,11 @@ TEST(DXCFile, ParseEmptyParts) {
0x74, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00,
0x44, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
0x5C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
- 0x53, 0x46, 0x49, 0x30, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31,
- 0x00, 0x00, 0x00, 0x00, 0x4F, 0x53, 0x47, 0x31, 0x00, 0x00, 0x00, 0x00,
- 0x50, 0x53, 0x56, 0x30, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54,
- 0x00, 0x00, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4C, 0x00, 0x00, 0x00, 0x00,
- 0x44, 0x45, 0x41, 0x44, 0x00, 0x00, 0x00, 0x00,
+ 0x46, 0x4B, 0x45, 0x30, 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x31,
+ 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x32, 0x00, 0x00, 0x00, 0x00,
+ 0x46, 0x4B, 0x45, 0x33, 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x34,
+ 0x00, 0x00, 0x00, 0x00, 0x46, 0x4B, 0x45, 0x35, 0x00, 0x00, 0x00, 0x00,
+ 0x46, 0x4B, 0x45, 0x36, 0x00, 0x00, 0x00, 0x00,
};
EXPECT_EQ(Storage.size(), 116u);
@@ -87,19 +87,19 @@ TEST(DXCFile, ParseEmptyParts) {
Minor: 0
PartCount: 7
Parts:
- - Name: SFI0
+ - Name: FKE0
Size: 0
- - Name: ISG1
+ - Name: FKE1
Size: 0
- - Name: OSG1
+ - Name: FKE2
Size: 0
- - Name: PSV0
+ - Name: FKE3
Size: 0
- - Name: STAT
+ - Name: FKE4
Size: 0
- - Name: DXIL
+ - Name: FKE5
Size: 0
- - Name: DEAD
+ - Name: FKE6
Size: 0
...
)"));
More information about the llvm-commits
mailing list