Skip to content

Commit 19991ce

Browse files
s-perronwooyoungqcom
authored andcommitted
[Kokoro] Add dxc-smoketest (KhronosGroup#6113)
New validation check in spir-val can identify invalid code generated by DXC. This will generally only be caught when DXC or SPIR-V tools is imported into Google3. This can take a while. Adding the smoke test will enable us to get an early warning that DXC needs to be updated.
1 parent fdda95c commit 19991ce

File tree

5 files changed

+96
-3
lines changed

5 files changed

+96
-3
lines changed

kokoro/dxc-smoketest/build.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Copyright (c) 2018 Google LLC.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Fail on any error.
17+
set -e
18+
# Display commands being run.
19+
set -x
20+
21+
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
22+
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE gcc cmake-dxc-smoketest
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2018 Google LLC.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Continuous build configuration.
16+
build_file: "SPIRV-Tools/kokoro/dxc-smoketest/build.sh"
17+

kokoro/dxc-smoketest/presubmit.cfg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2018 Google LLC.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Presubmit build configuration.
16+
build_file: "SPIRV-Tools/kokoro/dxc-smoketest/build.sh"
17+

kokoro/scripts/linux/build-docker.sh

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function clean_dir() {
4545
mkdir "$dir"
4646
}
4747

48-
if [ $TOOL != "cmake-smoketest" ]; then
48+
if [ $TOOL != "cmake-shaderc-smoketest" ] && [ $TOOL != "cmake-dxc-smoketest" ]; then
4949
# Get source for dependencies, as specified in the DEPS file
5050
/usr/bin/python3 utils/git-sync-deps --treeless
5151
fi
@@ -115,7 +115,7 @@ if [ $TOOL = "cmake" ]; then
115115
ninja install
116116
cd $KOKORO_ARTIFACTS_DIR
117117
tar czf install.tgz install
118-
elif [ $TOOL = "cmake-smoketest" ]; then
118+
elif [ $TOOL = "cmake-shaderc-smoketest" ]; then
119119
using cmake-3.31.2
120120
using ninja-1.10.0
121121

@@ -156,6 +156,43 @@ elif [ $TOOL = "cmake-smoketest" ]; then
156156
echo $(date): Starting ctest...
157157
ctest --output-on-failure -j4
158158
echo $(date): ctest completed.
159+
elif [ $TOOL = "cmake-dxc-smoketest" ]; then
160+
using cmake-3.31.2
161+
using ninja-1.10.0
162+
163+
# Get shaderc.
164+
DXC_DIR=/tmp/dxc
165+
clean_dir "$DXC_DIR"
166+
cd $DXC_DIR
167+
git clone https://github.com/microsoft/DirectXShaderCompiler.git .
168+
cd $DXC_DIR/external
169+
170+
# Get DXC dependencies. Link the appropriate SPIRV-Tools.
171+
git submodule update --init DirectX-Headers
172+
rm -rf SPIRV-Tools
173+
ln -s $ROOT_DIR SPIRV-Tools
174+
git clone https://github.com/KhronosGroup/SPIRV-Headers.git SPIRV-Headers
175+
176+
cd $DXC_DIR
177+
mkdir build
178+
cd $DXC_DIR/build
179+
180+
# Invoke the build.
181+
echo $(date): Configuring build...
182+
cmake $DXC_DIR \
183+
-C $DXC_DIR/cmake/caches/PredefinedParams.cmake \
184+
-DCMAKE_BUILD_TYPE="Release" \
185+
-G Ninja
186+
187+
echo $(date): Building ClangSPIRVTests...
188+
ninja ClangSPIRVTests
189+
190+
echo $(date): Testing ClangSPIRVTests...
191+
tools/clang/unittests/SPIRV/ClangSPIRVTests
192+
193+
echo $(date): Testing check-clang-codegenspirv...
194+
ninja check-clang-codegenspirv
195+
159196
elif [ $TOOL = "cmake-android-ndk" ]; then
160197
using cmake-3.31.2
161198
using ndk-r27c

kokoro/shaderc-smoketest/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ set -e
1919
set -x
2020

2121
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
22-
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE gcc cmake-smoketest
22+
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE gcc cmake-shaderc-smoketest

0 commit comments

Comments
 (0)