Skip to content

Commit 5f7834d

Browse files
authored
[lit][SPIRV] convert runCodeTest to lit and remove dependence on effcee (microsoft#6077)
Convert runCodeTest to lit FileCheck test and remove all the code related to runCodeTest. Remove effcee and re2 from git submodule since nothing is dependent on them after the change.
1 parent ad3958c commit 5f7834d

14 files changed

+82
-891
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
[submodule "external/googletest"]
88
path = external/googletest
99
url = https://github.com/google/googletest
10-
[submodule "external/re2"]
11-
path = external/re2
12-
url = https://github.com/google/re2
13-
[submodule "external/effcee"]
14-
path = external/effcee
15-
url = https://github.com/google/effcee
1610
[submodule "external/DirectX-Headers"]
1711
path = external/DirectX-Headers
1812
url = https://github.com/microsoft/DirectX-Headers.git

external/CMakeLists.txt

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -72,49 +72,4 @@ if (${ENABLE_SPIRV_CODEGEN})
7272
set_property(TARGET ${target} PROPERTY FOLDER "External dependencies")
7373
endforeach()
7474

75-
# We need Effcee for SPIR-V codegen testing.
76-
if (${SPIRV_BUILD_TESTS})
77-
# re2 is needed since it's required by effcee.
78-
set(DXC_RE2_DIR "${DXC_EXTERNAL_ROOT_DIR}/re2" CACHE STRING "Location of RE2 source")
79-
set(DXC_EFFCEE_DIR "${DXC_EXTERNAL_ROOT_DIR}/effcee" CACHE STRING "Location of Effcee source")
80-
81-
if (NOT TARGET re2)
82-
if (IS_DIRECTORY ${DXC_RE2_DIR})
83-
# Avoid exception handling warning from MSVC.
84-
# This add_compile_options() will only affect the current directory and its subdirectories.
85-
if (WIN32)
86-
add_compile_options(/EHs)
87-
else(WIN32)
88-
# Disable all warnings in subproject RE2
89-
add_compile_options(-w)
90-
endif(WIN32)
91-
# Don't build/run re2's tests.
92-
set(RE2_BUILD_TESTING OFF CACHE BOOL "Skip RE2 tests")
93-
add_subdirectory(${DXC_RE2_DIR} EXCLUDE_FROM_ALL)
94-
endif()
95-
endif()
96-
97-
if (NOT TARGET effcee)
98-
if (IS_DIRECTORY ${DXC_EFFCEE_DIR})
99-
# Configure effcee
100-
set(EFFCEE_RE2_DIR "${DXC_RE2_DIR}" CACHE STRING "Location of RE2 for effcee")
101-
set(EFFCEE_ENABLE_SHARED_CRT ON CACHE BOOL "Enable using shared C Runtime")
102-
# Don't build/run effcee's tests.
103-
set(EFFCEE_BUILD_TESTING OFF CACHE BOOL "Skip effcee tests")
104-
set(EFFCEE_BUILD_SAMPLES OFF CACHE BOOL "Skip building effcee examples")
105-
add_subdirectory(${DXC_EFFCEE_DIR} EXCLUDE_FROM_ALL)
106-
endif()
107-
endif()
108-
109-
# Organize these targets better in Visual Studio
110-
set(SPIRV_TEST_DEP_TARGETS
111-
effcee
112-
re2
113-
)
114-
foreach(target ${SPIRV_TEST_DEP_TARGETS})
115-
set_property(TARGET ${target} PROPERTY FOLDER "External dependencies")
116-
endforeach()
117-
118-
endif()
119-
12075
endif()

external/effcee

Lines changed: 0 additions & 1 deletion
This file was deleted.

external/re2

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %dxc -T ps_6_0 -E PSMain -fcgl %s -spirv | FileCheck %s
2+
3+
struct PSInput
4+
{
5+
float4 color : COLOR;
6+
};
7+
8+
// CHECK: OpFunctionCall %v4float %src_PSMain
9+
float4 PSMain(PSInput input) : SV_TARGET
10+
{
11+
return input.color;
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: not %dxc -T ps_6_0 -E PSMain -fcgl %s -spirv 2>&1 | FileCheck %s
2+
3+
struct PSInput
4+
{
5+
float4 color : COLOR;
6+
};
7+
8+
// CHECK: error: cannot initialize return object of type 'float4' with an lvalue of type 'PSInput'
9+
float4 PSMain(PSInput input) : SV_TARGET
10+
{
11+
return input;
12+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// RUN: not %dxc -T vs_6_2 -E main -DTY=float -DARRAY=[4] -fcgl %s -spirv 2>&1 | FileCheck %s
2+
// RUN: not %dxc -T vs_6_2 -E main -DTY=double4 -fcgl %s -spirv 2>&1 | FileCheck %s
3+
// RUN: not %dxc -T vs_6_2 -E main -DTY=int4 -fcgl %s -spirv 2>&1 | FileCheck %s
4+
// RUN: not %dxc -T vs_6_2 -E main -DTY=float1x4 -fcgl %s -spirv 2>&1 | FileCheck %s
5+
// RUN: not %dxc -T vs_6_2 -E main -DTY=float3 -fcgl %s -spirv 2>&1 | FileCheck %s
6+
// RUN: not %dxc -T vs_6_2 -E main -DTY=InvalidType -fcgl %s -spirv 2>&1 | FileCheck %s
7+
8+
// RUN: %dxc -T vs_6_2 -E main -DTY=ValidType -fcgl %s -spirv | FileCheck %s --check-prefix=VALID_TY
9+
10+
// RUN: %dxc -T vs_6_2 -E main -DTY=float4 -fcgl %s -spirv | FileCheck %s --check-prefix=VALID_FLOAT
11+
// RUN: %dxc -T vs_6_2 -E main -DTY=min10float4 -fcgl %s -spirv | FileCheck %s --check-prefix=VALID_FLOAT
12+
// RUN: %dxc -T vs_6_2 -E main -DTY=min16float4 -fcgl %s -spirv | FileCheck %s --check-prefix=VALID_FLOAT
13+
// RUN: %dxc -T vs_6_2 -E main -DTY=half4 -fcgl %s -spirv | FileCheck %s --check-prefix=VALID_FLOAT
14+
15+
// RUN: not %dxc -T vs_6_2 -E main -enable-16bit-types -DTY=half4 -fcgl %s -spirv 2>&1 | FileCheck %s
16+
// RUN: not %dxc -T vs_6_2 -E main -enable-16bit-types -DTY=min10float4 -fcgl %s -spirv 2>&1 | FileCheck %s
17+
18+
19+
// CHECK: error: SV_Position must be a 4-component 32-bit float vector or a composite which recursively contains only such a vector
20+
21+
// VALID_TY: %ValidType = OpTypeStruct %v4float
22+
// VALID_TY: %output = OpTypeStruct %ValidType
23+
24+
// VALID_FLOAT: %output = OpTypeStruct %v4float
25+
26+
27+
28+
29+
struct InvalidType {
30+
float3 x;
31+
};
32+
33+
struct ValidType {
34+
float4 x;
35+
};
36+
37+
#ifndef ARRAY
38+
#define ARRAY
39+
#endif
40+
41+
#define POSITION TY x ARRAY
42+
43+
struct output {
44+
POSITION;
45+
};
46+
47+
48+
49+
output main() : SV_Position
50+
{
51+
output result;
52+
return result;
53+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %dxc -T ps_6_0 -E PSMain -Zi -fcgl %s -spirv | FileCheck %s
2+
3+
float4 PSMain(float4 color : COLOR) : SV_TARGET { return color; }
4+
// CHECK: float4 PSMain(float4 color : COLOR) : SV_TARGET { return color; }

tools/clang/unittests/SPIRV/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ set(LLVM_LINK_COMPONENTS
77
)
88

99
add_clang_unittest(ClangSPIRVTests
10-
CodeGenSpirvTest.cpp
11-
FileTestFixture.cpp
12-
FileTestUtils.cpp
1310
SpirvBasicBlockTest.cpp
1411
SpirvContextTest.cpp
1512
SpirvTestOptions.cpp
@@ -28,7 +25,6 @@ target_link_libraries(ClangSPIRVTests
2825
clangSPIRV
2926
clangTooling
3027
dxcompiler
31-
effcee
3228
SPIRV-Tools
3329
)
3430

@@ -38,7 +34,7 @@ target_link_libraries(ClangSPIRVTests
3834
add_dependencies(ClangSPIRVTests dxcompiler)
3935

4036
target_include_directories(ClangSPIRVTests
41-
PRIVATE ${SPIRV_TOOLS_INCLUDE_DIR} ${DXC_EFFCEE_DIR})
37+
PRIVATE ${SPIRV_TOOLS_INCLUDE_DIR})
4238

4339
if (NOT CLANG_INCLUDE_TESTS)
4440
set_output_directory(ClangSPIRVTests

tools/clang/unittests/SPIRV/CodeGenSpirvTest.cpp

Lines changed: 0 additions & 167 deletions
This file was deleted.

0 commit comments

Comments
 (0)