Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/kokoro
diff options
context:
space:
mode:
authorAlastair Donaldson <afdx@google.com>2021-09-10 15:53:09 +0300
committerGitHub <noreply@github.com>2021-09-10 15:53:09 +0300
commit2a938fcfa3ff19f0446be4da213914a75c6606c5 (patch)
treef6d321de53d2276815311ad0d01504376b44eabc /kokoro
parentc16224c6845e8b7243db8c8a6a70af2bf9abae74 (diff)
Add UBSan kokoro configuration (#4512)
Adds a kokoro configuration for UBSan, to allow this sanitizer to be used during continuous integration.
Diffstat (limited to 'kokoro')
-rwxr-xr-xkokoro/linux-clang-ubsan/build.sh24
-rw-r--r--kokoro/linux-clang-ubsan/continuous.cfg16
-rw-r--r--kokoro/linux-clang-ubsan/presubmit.cfg16
-rwxr-xr-xkokoro/scripts/linux/build-docker.sh9
4 files changed, 64 insertions, 1 deletions
diff --git a/kokoro/linux-clang-ubsan/build.sh b/kokoro/linux-clang-ubsan/build.sh
new file mode 100755
index 000000000..b5941e340
--- /dev/null
+++ b/kokoro/linux-clang-ubsan/build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+# Copyright (c) 2021 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Linux Build Script.
+
+# Fail on any error.
+set -e
+# Display commands being run.
+set -x
+
+SCRIPT_DIR=`dirname "$BASH_SOURCE"`
+source $SCRIPT_DIR/../scripts/linux/build.sh UBSAN clang cmake
diff --git a/kokoro/linux-clang-ubsan/continuous.cfg b/kokoro/linux-clang-ubsan/continuous.cfg
new file mode 100644
index 000000000..cb5535e14
--- /dev/null
+++ b/kokoro/linux-clang-ubsan/continuous.cfg
@@ -0,0 +1,16 @@
+# Copyright (c) 2021 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Continuous build configuration.
+build_file: "SPIRV-Tools/kokoro/linux-clang-ubsan/build.sh"
diff --git a/kokoro/linux-clang-ubsan/presubmit.cfg b/kokoro/linux-clang-ubsan/presubmit.cfg
new file mode 100644
index 000000000..029c74a52
--- /dev/null
+++ b/kokoro/linux-clang-ubsan/presubmit.cfg
@@ -0,0 +1,16 @@
+# Copyright (c) 2021 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Presubmit build configuration.
+build_file: "SPIRV-Tools/kokoro/linux-clang-ubsan/build.sh"
diff --git a/kokoro/scripts/linux/build-docker.sh b/kokoro/scripts/linux/build-docker.sh
index c6bbe9512..84457a1be 100755
--- a/kokoro/scripts/linux/build-docker.sh
+++ b/kokoro/scripts/linux/build-docker.sh
@@ -58,7 +58,7 @@ if [ $TOOL = "cmake" ]; then
using ninja-1.10.0
# Possible configurations are:
- # ASAN, COVERAGE, RELEASE, DEBUG, DEBUG_EXCEPTION, RELEASE_MINGW
+ # ASAN, UBSAN, COVERAGE, RELEASE, DEBUG, DEBUG_EXCEPTION, RELEASE_MINGW
BUILD_TYPE="Debug"
if [ $CONFIG = "RELEASE" ] || [ $CONFIG = "RELEASE_MINGW" ]; then
BUILD_TYPE="RelWithDebInfo"
@@ -69,6 +69,13 @@ if [ $TOOL = "cmake" ]; then
if [ $CONFIG = "ASAN" ]; then
ADDITIONAL_CMAKE_FLAGS="-DSPIRV_USE_SANITIZER=address,bounds,null"
[ $COMPILER = "clang" ] || { echo "$CONFIG requires clang"; exit 1; }
+ elif [ $CONFIG = "UBSAN" ]; then
+ # UBSan requires RTTI, and by default UBSan does not exit when errors are
+ # encountered - additional compiler options are required to force this.
+ # The -DSPIRV_USE_SANITIZER=undefined option instructs SPIR-V Tools to be
+ # built with UBSan enabled.
+ ADDITIONAL_CMAKE_FLAGS="-DSPIRV_USE_SANITIZER=undefined -DENABLE_RTTI=ON -DCMAKE_C_FLAGS=-fno-sanitize-recover -DCMAKE_CXX_FLAGS=-fno-sanitize-recover"
+ [ $COMPILER = "clang" ] || { echo "$CONFIG requires clang"; exit 1; }
elif [ $CONFIG = "COVERAGE" ]; then
ADDITIONAL_CMAKE_FLAGS="-DENABLE_CODE_COVERAGE=ON"
SKIP_TESTS="True"