mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Add an asan to our gitlab ci suite
This commit is contained in:
parent
e28b80649e
commit
b3924ef302
@ -5,22 +5,27 @@
|
||||
# * .gitlab/ci/docker/centos7/cuda10.2/
|
||||
# - cuda
|
||||
# - gcc 4.8.5
|
||||
# * .gitlab/ci/rhel8/cuda10.2/
|
||||
# * .gitlab/ci/docker/centos8/base/
|
||||
# - gcc 8.3.1
|
||||
# - clang 8.0.1
|
||||
# - openmp
|
||||
# - asan, ubsan
|
||||
# * .gitlab/ci/docker/rhel8/cuda10.2/
|
||||
# - cuda
|
||||
# - gcc 8.2.1
|
||||
# * .gitlab/ci/ubuntu1604/base/
|
||||
# * .gitlab/ci/docker/ubuntu1604/base/
|
||||
# - gcc 4.8
|
||||
# - clang 3.8
|
||||
# - clang 5.0
|
||||
# - tbb
|
||||
# - openmpi
|
||||
# * .gitlab/ci/ubuntu1604/cuda9.2/
|
||||
# * .gitlab/ci/docker/ubuntu1604/cuda9.2/
|
||||
# - cuda
|
||||
# - gcc 5.4
|
||||
# - tbb
|
||||
# - openmp
|
||||
# - openmpi
|
||||
# * .gitlab/ci/ubuntu1804/base/
|
||||
# * .gitlab/ci/docker/ubuntu1804/base/
|
||||
# - gcc 6.5
|
||||
# - gcc 7.4
|
||||
# - gcc 9
|
||||
@ -28,7 +33,7 @@
|
||||
# - tbb
|
||||
# - openmp
|
||||
# - mpich2
|
||||
# * .gitlab/ci/ubuntu1804/cuda10.1/
|
||||
# * .gitlab/ci/docker/ubuntu1804/cuda10.1/
|
||||
# - cuda
|
||||
# - gcc 7.4
|
||||
# - tbb
|
||||
@ -44,6 +49,11 @@
|
||||
extends:
|
||||
- .docker_image
|
||||
|
||||
.centos8: ¢os8
|
||||
image: "kitware/vtkm:ci-centos8-20200410"
|
||||
extends:
|
||||
- .docker_image
|
||||
|
||||
.rhel8: &rhel8
|
||||
image: "kitware/vtkm:ci-rhel8_cuda10.2-20200410"
|
||||
extends:
|
||||
@ -146,8 +156,16 @@ stages:
|
||||
#due to system load are not reported
|
||||
- "ctest-latest -VV -S .gitlab/ci/ctest_test.cmake"
|
||||
|
||||
.cmake_memcheck_linux: &cmake_memcheck_linux
|
||||
stage: test
|
||||
timeout: 2 hours
|
||||
interruptible: true
|
||||
script:
|
||||
- "ctest-latest -VV -S .gitlab/ci/ctest_memcheck.cmake"
|
||||
|
||||
include:
|
||||
- local: '/.gitlab/ci/centos7.yml'
|
||||
- local: '/.gitlab/ci/centos8.yml'
|
||||
- local: '/.gitlab/ci/rhel8.yml'
|
||||
- local: '/.gitlab/ci/ubuntu1604.yml'
|
||||
- local: '/.gitlab/ci/ubuntu1804.yml'
|
||||
|
53
.gitlab/ci/centos8.yml
Normal file
53
.gitlab/ci/centos8.yml
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
# Build on centos8 with serial and test on centos8
|
||||
# Uses gcc 8.2.1
|
||||
build:centos8_sanitizer:
|
||||
tags:
|
||||
- build
|
||||
- vtkm
|
||||
- docker
|
||||
- linux
|
||||
extends:
|
||||
- .centos8
|
||||
- .cmake_build_linux
|
||||
- .only-default
|
||||
variables:
|
||||
CMAKE_BUILD_TYPE: RelWithDebInfo
|
||||
CMAKE_GENERATOR: "Unix Makefiles"
|
||||
VTKM_SETTINGS: "serial+shared+asan+leak"
|
||||
|
||||
test:centos8_asan:
|
||||
tags:
|
||||
- test
|
||||
- vtkm
|
||||
- docker
|
||||
- linux
|
||||
- privileged
|
||||
extends:
|
||||
- .centos8
|
||||
- .cmake_memcheck_linux
|
||||
- .only-default
|
||||
variables:
|
||||
CTEST_MEMORYCHECK_TYPE: LeakSanitizer
|
||||
dependencies:
|
||||
- build:centos8_sanitizer
|
||||
needs:
|
||||
- build:centos8_sanitizer
|
||||
|
||||
test:centos8_leak:
|
||||
tags:
|
||||
- test
|
||||
- vtkm
|
||||
- docker
|
||||
- linux
|
||||
- privileged
|
||||
extends:
|
||||
- .centos8
|
||||
- .cmake_memcheck_linux
|
||||
- .only-default
|
||||
variables:
|
||||
CTEST_MEMORYCHECK_TYPE: AddressSanitizer
|
||||
dependencies:
|
||||
- build:centos8_sanitizer
|
||||
needs:
|
||||
- build:centos8_sanitizer
|
@ -63,6 +63,16 @@ if (CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles")
|
||||
set(CTEST_BUILD_FLAGS "-j${nproc}")
|
||||
endif ()
|
||||
|
||||
if(DEFINED ENV{CTEST_MEMORYCHECK_TYPE})
|
||||
set(env_value "$ENV{CTEST_MEMORYCHECK_TYPE}")
|
||||
list(APPEND optional_variables "set(CTEST_MEMORYCHECK_TYPE ${env_value})")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{CTEST_MEMORYCHECK_SANITIZER_OPTIONS})
|
||||
set(env_value "$ENV{CTEST_MEMORYCHECK_SANITIZER_OPTIONS}")
|
||||
list(APPEND optional_variables "set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS ${env_value})")
|
||||
endif()
|
||||
|
||||
#We need to do write this information out to a file in the build directory
|
||||
set(state
|
||||
"
|
||||
@ -77,6 +87,8 @@ set(state
|
||||
set(CTEST_BUILD_FLAGS \"${CTEST_BUILD_FLAGS}\")
|
||||
|
||||
set(CTEST_TRACK ${CTEST_TRACK})
|
||||
|
||||
${optional_variables}
|
||||
"
|
||||
)
|
||||
file(WRITE ${CTEST_BINARY_DIRECTORY}/CIState.cmake "${state}")
|
||||
|
@ -26,6 +26,14 @@ foreach(option IN LISTS options)
|
||||
elseif(64bit_floats STREQUAL option)
|
||||
set(VTKm_USE_DOUBLE_PRECISION "ON" CACHE STRING "")
|
||||
|
||||
elseif(asan STREQUAL option)
|
||||
set(VTKm_ENABLE_SANITIZER "ON" CACHE STRING "")
|
||||
list(APPEND sanitizers "address")
|
||||
|
||||
elseif(leak STREQUAL option)
|
||||
set(VTKm_ENABLE_SANITIZER "ON" CACHE STRING "")
|
||||
list(APPEND sanitizers "leak")
|
||||
|
||||
elseif(examples STREQUAL option)
|
||||
set(VTKm_ENABLE_EXAMPLES "ON" CACHE STRING "")
|
||||
|
||||
@ -75,3 +83,8 @@ if(SCCACHE_COMMAND)
|
||||
set(CMAKE_CUDA_COMPILER_LAUNCHER "${SCCACHE_COMMAND}" CACHE STRING "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Setup all the sanitizers as a list
|
||||
if(sanitizers)
|
||||
set(VTKm_USE_SANITIZER "${sanitizers}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
51
.gitlab/ci/ctest_memcheck.cmake
Normal file
51
.gitlab/ci/ctest_memcheck.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
##=============================================================================
|
||||
##
|
||||
## Copyright (c) Kitware, Inc.
|
||||
## All rights reserved.
|
||||
## See LICENSE.txt for details.
|
||||
##
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##
|
||||
##=============================================================================
|
||||
|
||||
# Read the files from the build directory that contain
|
||||
# host information ( name, parallel level, etc )
|
||||
include("$ENV{CI_PROJECT_DIR}/build/CIState.cmake")
|
||||
ctest_read_custom_files("${CTEST_BINARY_DIRECTORY}")
|
||||
|
||||
# Pick up from where the configure left off.
|
||||
ctest_start(APPEND)
|
||||
|
||||
if(NOT CTEST_MEMORYCHECK_TYPE)
|
||||
set(CTEST_MEMORYCHECK_TYPE "$ENV{CTEST_MEMORYCHECK_TYPE}")
|
||||
endif()
|
||||
|
||||
if(NOT CTEST_MEMORYCHECK_SANITIZER_OPTIONS)
|
||||
set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS "$ENV{CTEST_MEMORYCHECK_SANITIZER_OPTIONS}")
|
||||
endif()
|
||||
|
||||
|
||||
set(test_exclusions
|
||||
# placeholder for tests to exclude
|
||||
)
|
||||
|
||||
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
|
||||
if (test_exclusions)
|
||||
set(test_exclusions "(${test_exclusions})")
|
||||
endif ()
|
||||
|
||||
# reduced parallel level so we don't exhaust system resources
|
||||
ctest_memcheck(
|
||||
PARALLEL_LEVEL "4"
|
||||
RETURN_VALUE test_result
|
||||
EXCLUDE "${test_exclusions}"
|
||||
DEFECT_COUNT defects)
|
||||
|
||||
ctest_submit(PARTS Memcheck)
|
||||
|
||||
if (defects)
|
||||
message(FATAL_ERROR
|
||||
"Found ${defects} memcheck defects")
|
||||
endif ()
|
18
.gitlab/ci/docker/centos8/base/Dockerfile
Normal file
18
.gitlab/ci/docker/centos8/base/Dockerfile
Normal file
@ -0,0 +1,18 @@
|
||||
FROM centos:8
|
||||
LABEL maintainer "Robert Maynard<robert.maynard@kitware.com>"
|
||||
|
||||
RUN yum install make gcc gcc-c++ curl libasan libubsan libomp clang -y
|
||||
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | bash
|
||||
RUN yum install git git-lfs -y
|
||||
|
||||
# Provide CMake 3.17 so we can re-run tests easily
|
||||
# This will be used when we run just the tests
|
||||
RUN mkdir /opt/cmake-latest/ && \
|
||||
curl -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0-Linux-x86_64.sh > cmake-3.17.0-Linux-x86_64.sh && \
|
||||
sh cmake-3.17.0-Linux-x86_64.sh --prefix=/opt/cmake-latest/ --exclude-subdir --skip-license && \
|
||||
ln -s /opt/cmake-latest/bin/ctest /opt/cmake-latest/bin/ctest-latest
|
||||
|
||||
# Provide a consistent CMake path across all images. Just use the lastest cmake
|
||||
RUN mkdir -p /opt/cmake/bin && ln -s /opt/cmake-latest/bin/cmake /opt/cmake/bin/cmake
|
||||
|
||||
ENV PATH "/opt/cmake/bin:/opt/cmake-latest/bin:${PATH}"
|
@ -10,6 +10,10 @@ cd centos7/cuda10.2
|
||||
sudo docker build -t kitware/vtkm:ci-centos7_cuda10.2-$date .
|
||||
cd ../..
|
||||
|
||||
cd centos8/base
|
||||
sudo docker build -t kitware/vtkm:ci-centos8-$date .
|
||||
cd ../..
|
||||
|
||||
cd rhel8/cuda10.2
|
||||
sudo docker build -t kitware/vtkm:ci-rhel8_cuda10.2-$date .
|
||||
cd ../..
|
||||
|
@ -29,3 +29,4 @@ test:rhel8:
|
||||
- build:rhel8
|
||||
needs:
|
||||
- build:rhel8
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
##============================================================================
|
||||
## Copyright (c) Kitware, Inc.
|
||||
## All rights reserved.
|
||||
## See LICENSE.txt for details.
|
||||
##
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# check if this is a sanitizer build. If so, set up the environment.
|
||||
|
||||
function(vtkm_check_sanitizer_build)
|
||||
string (FIND "${CTEST_MEMORYCHECK_TYPE}" "Sanitizer" SANITIZER_BUILD)
|
||||
if (${SANITIZER_BUILD} GREATER -1)
|
||||
# This is a sanitizer build.
|
||||
# Configure the sanitizer blacklist file
|
||||
set (SANITIZER_BLACKLIST "${VTKm_BINARY_DIR}/sanitizer_blacklist.txt")
|
||||
configure_file (
|
||||
"${VTKm_SOURCE_DIR}/Utilities/DynamicAnalysis/sanitizer_blacklist.txt.in"
|
||||
${SANITIZER_BLACKLIST}
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Add the compiler flags for blacklist
|
||||
set (FSANITIZE_BLACKLIST "\"-fsanitize-blacklist=${SANITIZER_BLACKLIST}\"")
|
||||
foreach (entity C CXX SHARED_LINKER EXE_LINKER MODULE_LINKER)
|
||||
set (CMAKE_${entity}_FLAGS "${CMAKE_${entity}_FLAGS} ${FSANITIZE_BLACKLIST}")
|
||||
endforeach ()
|
||||
endif ()
|
||||
endfunction()
|
53
CMake/testing/VTKmCompilerDynamicAnalysisFlags.cmake
Normal file
53
CMake/testing/VTKmCompilerDynamicAnalysisFlags.cmake
Normal file
@ -0,0 +1,53 @@
|
||||
##============================================================================
|
||||
## Copyright (c) Kitware, Inc.
|
||||
## All rights reserved.
|
||||
## See LICENSE.txt for details.
|
||||
##
|
||||
## This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# check if this is a sanitizer build. If so, set up the environment.
|
||||
|
||||
function(vtkm_check_sanitizer_build)
|
||||
|
||||
# each line is a separate entry
|
||||
set(blacklist_file_content "
|
||||
src:${VTKm_SOURCE_DIR}/vtkm/thirdparty/
|
||||
")
|
||||
set (sanitizer_blacklist "${VTKm_BINARY_DIR}/sanitizer_blacklist.txt")
|
||||
file(WRITE "${sanitizer_blacklist}" "${blacklist_file_content}")
|
||||
|
||||
set(sanitizer_flags )
|
||||
foreach(sanitizer IN LISTS VTKm_USE_SANITIZER)
|
||||
string(APPEND sanitizer_flags "-fsanitize=${sanitizer} ")
|
||||
endforeach()
|
||||
# Add the compiler flags for blacklist
|
||||
if(VTKM_COMPILER_IS_CLANG)
|
||||
string(APPEND sanitizer_flags "\"-fsanitize-blacklist=${sanitizer_blacklist}\"")
|
||||
endif()
|
||||
foreach (entity C CXX SHARED_LINKER EXE_LINKER)
|
||||
set (CMAKE_${entity}_FLAGS "${CMAKE_${entity}_FLAGS} ${sanitizer_flags}" PARENT_SCOPE)
|
||||
endforeach ()
|
||||
|
||||
endfunction()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
set(CMAKE_COMPILER_IS_CLANGXX 1)
|
||||
endif()
|
||||
|
||||
if(VTKM_COMPILER_IS_CLANG OR VTKM_COMPILER_IS_GNU)
|
||||
vtkm_option(VTKm_ENABLE_SANITIZER "Build with sanitizer support." OFF)
|
||||
mark_as_advanced(VTKm_ENABLE_SANITIZER)
|
||||
|
||||
set(VTKm_USE_SANITIZER "address" CACHE STRING "The sanitizer to use")
|
||||
mark_as_advanced(VTKm_USE_SANITIZER)
|
||||
|
||||
if(VTKm_ENABLE_SANITIZER)
|
||||
vtkm_check_sanitizer_build()
|
||||
endif()
|
||||
|
||||
endif()
|
@ -199,10 +199,9 @@ if (VTKm_ENABLE_TESTING)
|
||||
# faux variadic template code
|
||||
find_package(Pyexpander QUIET)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup compiler flags for dynamic analysis if needed
|
||||
include(VTKmCompilerDynamicAnalysisFlags)
|
||||
vtkm_check_sanitizer_build()
|
||||
include(testing/VTKmCompilerDynamicAnalysisFlags)
|
||||
|
||||
endif (VTKm_ENABLE_TESTING)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@ -1,2 +0,0 @@
|
||||
# Blacklist third party libraries from invoking sanitizer errors
|
||||
src:@VTKm_SOURCE_DIR@/vtkm/thirdparty/*
|
Loading…
Reference in New Issue
Block a user