Add UBSan kokoro configuration (#4512)

Adds a kokoro configuration for UBSan, to allow this sanitizer to be
used during continuous integration.
This commit is contained in:
Alastair Donaldson 2021-09-10 13:53:09 +01:00 committed by GitHub
parent c16224c684
commit 2a938fcfa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 1 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"