Skip to content

Commit 36fdecf

Browse files
authored
Update Linux build and test workflows to use lit (#4836)
* Update Linux build and test workflows to use lit This change updates the build and test workflows in our azure pipelines and the GitHub action for code coverage data to use lit instead of ctest as the test runner. This adds additional test coverage by running some of the LLVM & Clang tests. * Fix missing dependency between LLVMAnalysis & DXIL The default Linux linker fails because LLVMAnalysis depends on LLVMDXIL and BFD doesn't cycle libraries. * Updating pipelines to remove mkdir and cd This just cleans up the pipeline shell commands to avoid unnecissary mkdir and cd invocations. Based on feedback from @Keenuts. Thanks! * Disable LLVM LIT tests that use garbage collection DXC disabled support for the LLVM garbage collection intrinsics.
1 parent 3ae7054 commit 36fdecf

8 files changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/coverage-gh-pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ jobs:
3333
- name: Install dependencies
3434
run: sudo apt install -y ninja-build
3535
- name: Configure
36-
run: mkdir build && cd build && cmake -G Ninja -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE=Release -DDXC_COVERAGE=On -C ${{github.workspace}}/cmake/caches/PredefinedParams.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ${{github.workspace}}
36+
run: cmake -B build -G Ninja -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_USE_LINKER=lld -DCMAKE_BUILD_TYPE=Release -DDXC_USE_LIT=On -DDXC_COVERAGE=On -C ${{github.workspace}}/cmake/caches/PredefinedParams.cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ${{github.workspace}}
3737
- name: Build
38-
run: cd build && ninja
38+
run: ninja -C build test-depends
3939
- name: Test
40-
run: cd build && ctest --rerun-failed --output-on-failure
40+
run: ninja -C build check-all
4141
- name: Generate Report
42-
run: cd build && ninja generate-coverage-report
42+
run: ninja -C build generate-coverage-report
4343
- name: Upload artifact
4444
uses: actions/upload-pages-artifact@v1
4545
with:

azure-pipelines.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,10 @@ stages:
110110
displayName: 'Installing dependencies'
111111
condition: eq(variables['image'], variables['macOS'])
112112
- bash: |
113-
mkdir build
114-
cd build
115-
cmake -G Ninja $BUILD_SOURCESDIRECTORY -C $BUILD_SOURCESDIRECTORY/cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$(configuration) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_CXX_FLAGS=$(CXX_FLAGS)
113+
cmake -B build -G Ninja $BUILD_SOURCESDIRECTORY -DLLVM_LIT_ARGS=--xunit-xml-output=testresults.xunit.xml -DDXC_USE_LIT=On -C $BUILD_SOURCESDIRECTORY/cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$(configuration) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_CXX_FLAGS=$(CXX_FLAGS)
116114
displayName: 'Running Cmake'
117115
- bash: |
118-
cd build
119-
ninja
116+
ninja -C build test-depends
120117
displayName: 'Building'
121118
- bash: |
122119
./build/bin/dxc -T ps_6_0 tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
@@ -125,8 +122,10 @@ stages:
125122
ls -ld $AGENT_BUILDDIRECTORY
126123
ls -ld $BUILD_SOURCESDIRECTORY
127124
displayName: 'Smoke tests'
128-
- bash: ./build/bin/clang-spirv-tests --spirv-test-root tools/clang/test/CodeGenSPIRV/
129-
displayName: 'SPIRV tests'
130-
- bash: ./build/bin/clang-hlsl-tests --HlslDataDir $PWD/tools/clang/test/HLSL/
131-
displayName: 'DXIL tests'
125+
- bash: ninja -C build check-all
126+
displayName: 'DXC tests'
127+
- task: PublishTestResults@2
128+
inputs:
129+
testResultsFormat: 'XUnit'
130+
testREsultsFiles: '**/testresults.xunit.xml'
132131

cmake/caches/PredefinedParams.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if (DXC_COVERAGE)
99
set(LLVM_BUILD_INSTRUMENTED_COVERAGE ON CACHE BOOL "")
1010
set(LLVM_PROFILE_DATA_DIR "${CMAKE_BINARY_DIR}/profile" CACHE STRING "")
1111
set(LLVM_CODE_COVERAGE_TARGETS "dxc;dxcompiler" CACHE STRING "")
12+
set(LLVM_CODE_COVERAGE_TEST_TARGETS "check-all" CACHE STRING "")
1213
endif()
1314

1415
if (DXC_USE_LIT)
@@ -38,4 +39,4 @@ set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
3839
set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
3940
set(HLSL_INCLUDE_TESTS ON CACHE BOOL "")
4041
set(ENABLE_SPIRV_CODEGEN ON CACHE BOOL "")
41-
set(SPIRV_BUILD_TESTS ON CACHE BOOL "")
42+
set(SPIRV_BUILD_TESTS ON CACHE BOOL "")

lib/Analysis/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ add_llvm_library(LLVMAnalysis
7676
${LLVM_MAIN_INCLUDE_DIR}/llvm/Analysis
7777
)
7878

79+
target_link_libraries(LLVMAnalysis INTERFACE LLVMDXIL) # HLSL Change
7980
add_dependencies(LLVMAnalysis intrinsics_gen)
8081

8182
add_subdirectory(IPA)

test/Verifier/gc_relocate_addrspace.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
; This is to verify that gc_relocate must return a pointer with the same
33
; address space with the relocated value.
44

5+
; REQUIRES: hlsl-gc.statepoint-unsupported
6+
57
; CHECK: gc.relocate: relocating a pointer shouldn't change its address space
68
; CHECK-NEXT: %obj.relocated = call coldcc i8* @llvm.experimental.gc.relocate.p0i8(i32 %safepoint_token, i32 7, i32 7) ;
79

test/Verifier/gc_relocate_operand.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
; RUN: not llvm-as -disable-output <%s 2>&1 | FileCheck %s
22
; This is to verify that the relocated value by gc_relocate must be a pointer type.
33

4+
; REQUIRES: hlsl-gc.statepoint-unsupported
45
; CHECK: gc.relocate: relocated value must be a gc pointer
56

67
declare void @foo()

test/Verifier/gc_relocate_return.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
; This is to verify that gc_relocate must return a pointer type, which is defined
33
; in intrinsics.td.
44

5+
; REQUIRES: hlsl-gc.statepoint-unsupported
56
; CHECK: Intrinsic has incorrect return type!
67

78
declare void @foo()

test/Verifier/invalid-statepoint2.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; RUN: not opt -S < %s -verify 2>&1 | FileCheck %s
22

3+
; REQUIRES: hlsl-gc.statepoint-unsupported
34
; CHECK: gc.statepoint: number of deoptimization arguments must be a constant integer
45

56
declare void @use(...)

0 commit comments

Comments
 (0)