Skip to content

Commit

Permalink
ci: rehaul sanitizer builds
Browse files Browse the repository at this point in the history
- Based them on opensuse tumbleweed to get recent
  versions of their packages.
- Update clang/llvm to 17
- Add build-images-opensuse-tw script
  • Loading branch information
vicentebolea committed Dec 6, 2024
1 parent 584f966 commit 2121827
Show file tree
Hide file tree
Showing 22 changed files with 218 additions and 147 deletions.
18 changes: 10 additions & 8 deletions .gitlab/gitlab-ci-spack.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file is used to define the GitLab CI/CD pipeline for the ADIOS2 project.
default:
interruptible: true
tags:
Expand Down Expand Up @@ -35,6 +36,7 @@ default:
- $CI_BIN_DIR/testing/
- $CI_BIN_DIR/source/**/*.h
- $CI_BIN_DIR/source/**/*.in
- $CI_BIN_DIR/adios2_reorganize_wrapper

# CTest and CMake install files.
- $CI_BIN_DIR/CMakeCache.txt
Expand All @@ -54,38 +56,38 @@ default:
#===============================================================================

build:uo-sanitizer-asan:
image: ornladios/adios2:ci-fedora-asan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-asan-20241205
extends: [.common-build]

build:uo-sanitizer-msan:
image: ornladios/adios2:ci-fedora-msan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-msan-20241205
extends: [.common-build]

build:uo-sanitizer-tsan:
image: ornladios/adios2:ci-fedora-tsan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-tsan-20241205
extends: [.common-build]

build:uo-sanitizer-ubsan:
image: ornladios/adios2:ci-fedora-ubsan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-ubsan-20241205
extends: [.common-build]

test:uo-sanitizer-asan:
image: ornladios/adios2:ci-fedora-asan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-asan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-asan]

test:uo-sanitizer-msan:
image: ornladios/adios2:ci-fedora-msan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-msan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-msan]

test:uo-sanitizer-tsan:
image: ornladios/adios2:ci-fedora-tsan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-tsan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-tsan]

test:uo-sanitizer-ubsan:
image: ornladios/adios2:ci-fedora-ubsan
image: ghcr.io/ornladios/adios2:ci-opensuse-tw-ubsan-20241205
extends: [.common-test]
needs: [build:uo-sanitizer-ubsan]

Expand Down
5 changes: 5 additions & 0 deletions scripts/ci/cmake/ci-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ if(NOT CTEST_BUILD_FLAGS)
set(CTEST_BUILD_FLAGS "-j${N2CPUS}")
endif()
endif()

if(NOT PARALLEL_LEVEL IN_LIST CTEST_TEST_ARGS)
list(APPEND CTEST_TEST_ARGS PARALLEL_LEVEL ${N2CPUS})
endif()

if(NOT PARALLEL_LEVEL IN_LIST CTEST_MEMCHECK_ARGS)
list(APPEND CTEST_MEMCHECK_ARGS PARALLEL_LEVEL ${N2CPUS})
endif()

if(NOT dashboard_model)
set(dashboard_model Experimental)
endif()
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/cmake/ci-el7-spack.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

include(ProcessorCount)
ProcessorCount(NCPUS)
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/cmake/ci-el7.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

set(ENV{CC} gcc)
set(ENV{CXX} g++)
Expand Down
11 changes: 10 additions & 1 deletion scripts/ci/cmake/ci-uo-sanitizer-asan.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

set(ENV{CC} clang)
set(ENV{CXX} clang++)
Expand All @@ -8,6 +8,8 @@ set(ENV{LSAN_OPTIONS} "suppressions=$ENV{CI_SOURCE_DIR}/scripts/ci/cmake/adios-a
set(ENV{CFLAGS} "${ASAN_FLAGS}")
set(ENV{CXXFLAGS} "${ASAN_FLAGS}")

set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS "detect_odr_violation=0")

set(dashboard_cache "
BUILD_TESTING:BOOL=ON
ADIOS2_BUILD_EXAMPLES:BOOL=ON
Expand All @@ -23,6 +25,13 @@ set(dashboard_track "Analysis")
set(CTEST_CMAKE_GENERATOR "Ninja")
set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer")

list(APPEND EXCLUDE_EXPRESSIONS
"Install.*"
"Unit.FileTransport.FailOnEOF.Serial"
)
list(JOIN EXCLUDE_EXPRESSIONS "|" TEST_EXCLUDE_STRING)
set(CTEST_MEMCHECK_ARGS EXCLUDE "${TEST_EXCLUDE_STRING}")

set(ADIOS_TEST_REPEAT 0)
list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake)
12 changes: 9 additions & 3 deletions scripts/ci/cmake/ci-uo-sanitizer-msan.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Client maintainer: [email protected]
# Client maintainer: [email protected]

set(ENV{CC} clang)
set(ENV{CXX} clang++)

set(dashboard_cache "
BUILD_TESTING:BOOL=ON
Expand All @@ -19,8 +22,11 @@ set(CTEST_CMAKE_GENERATOR "Ninja")
set(CTEST_MEMORYCHECK_TYPE "MemorySanitizer")

list(APPEND EXCLUDE_EXPRESSIONS
"Engine.BP.BPBufferSizeTest.SyncDeferredIdenticalUsage.BP3.Serial"
"Engine.BP.BPBufferSizeTest.SyncDeferredIdenticalUsage.BP4.Serial"
"Install.*"
"Staging.1x1DefSync.BP3"
"Engine.DataMan.DataManEngineTest"
"Unit.FileTransport.FailOnEOF.Serial"
"Engine.BP.BPBufferSizeTest.SyncDeferredIdenticalUsage.*.Serial"
)
list(JOIN EXCLUDE_EXPRESSIONS "|" TEST_EXCLUDE_STRING)
set(CTEST_MEMCHECK_ARGS EXCLUDE "${TEST_EXCLUDE_STRING}")
Expand Down
10 changes: 9 additions & 1 deletion scripts/ci/cmake/ci-uo-sanitizer-tsan.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

set(dashboard_cache "
BUILD_TESTING:BOOL=ON
Expand All @@ -18,6 +18,14 @@ set(dashboard_track "Analysis")
set(CTEST_CMAKE_GENERATOR "Ninja")
set(CTEST_MEMORYCHECK_TYPE "ThreadSanitizer")

list(APPEND EXCLUDE_EXPRESSIONS
"Install.*"
"Unit.FileTransport.FailOnEOF.Serial"
"Engine.BP.BPBufferSizeTest.SyncDeferredIdenticalUsage.*.Serial"
)
list(JOIN EXCLUDE_EXPRESSIONS "|" TEST_EXCLUDE_STRING)
set(CTEST_MEMCHECK_ARGS EXCLUDE "${TEST_EXCLUDE_STRING}")

set(ADIOS_TEST_REPEAT 0)
list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake)
12 changes: 10 additions & 2 deletions scripts/ci/cmake/ci-uo-sanitizer-ubsan.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Client maintainer: chuck.atkins@kitware.com
# Client maintainer: vicente.bolea@kitware.com

set(ENV{CC} gcc)
set(ENV{CXX} g++)
Expand All @@ -7,14 +7,15 @@ set(UBSAN_FLAGS "-fsanitize=undefined -fno-sanitize-recover=all -pthread")
set(ENV{CFLAGS} "${UBSAN_FLAGS}")
set(ENV{CXXFLAGS} "${UBSAN_FLAGS}")
set(ENV{FFLAGS} "${UBSAN_FLAGS}")
set(ENV{UBSAN_OPTIONS} "print_stacktrace=1")
set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS "print_stacktrace=1")

set(dashboard_cache "
BUILD_TESTING:BOOL=ON
ADIOS2_BUILD_EXAMPLES:BOOL=ON
ADIOS2_USE_HDF5:STRING=ON
ADIOS2_USE_MPI:STRING=OFF
ADIOS2_USE_Python:STRING=OFF
HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5cc
HDF5_DIFF_EXECUTABLE:FILEPATH=/usr/bin/h5diff
Expand All @@ -24,6 +25,13 @@ set(dashboard_track "Analysis")
set(CTEST_CMAKE_GENERATOR "Ninja")
set(CTEST_MEMORYCHECK_TYPE "UndefinedBehaviorSanitizer")

list(APPEND EXCLUDE_EXPRESSIONS
"Install.*"
"Unit.FileTransport.FailOnEOF.Serial"
)
list(JOIN EXCLUDE_EXPRESSIONS "|" TEST_EXCLUDE_STRING)
set(CTEST_MEMCHECK_ARGS EXCLUDE "${TEST_EXCLUDE_STRING}")

set(ADIOS_TEST_REPEAT 0)
list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/ci-common.cmake)
21 changes: 0 additions & 21 deletions scripts/ci/images/fedora-asan/Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions scripts/ci/images/fedora-sanitizers-base/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/ci/images/fedora-tsan/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/ci/images/fedora-ubsan/Dockerfile

This file was deleted.

49 changes: 49 additions & 0 deletions scripts/ci/images/opensuse-tw/build-images-opensuse-tw
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# This script is used to build the openSUSE Tumbleweed images

set -xeuo pipefail

declare -r DOCKER_REPOSITORY=ghcr.io/ornladios/adios2
declare -u ENABLE_PUSH=

#=============================================================================
# Functions

# Function to build a docker image
function docker_build() {
local docker_file=$1
local docker_tag=$2
local args=(--progress=plain --rm)

if [[ -n "${ENABLE_PUSH}" ]]; then
args+=("--push")
fi

sudo docker build "${args[@]}" \
--file "${docker_file}" \
--tag "${DOCKER_REPOSITORY}:${docker_tag}-$(date +"%Y%m%d")" \
.
}

function usage() {
echo "Usage: $0 [-p <PROJECT>] [-m <MILESTONE>]"
echo " -p Push to the docker registry"
exit 0
}

#=============================================================================
# Main
while getopts "p" o; do
case "${o}" in
p) ENABLE_PUSH=true ;;
*) usage ;;
esac
done

docker_build opensuse-tw-sanitizer-base.dockerfile ci-opensuse-tw-sanitizer-base
docker_build opensuse-tw-full-stack-onbuild.dockerfile ci-opensuse-tw-full-stack-onbuild
docker_build opensuse-tw-asan.dockerfile ci-opensuse-tw-asan
docker_build opensuse-tw-msan.dockerfile ci-opensuse-tw-msan
docker_build opensuse-tw-tsan.dockerfile ci-opensuse-tw-tsan
docker_build opensuse-tw-ubsan.dockerfile ci-opensuse-tw-ubsan
20 changes: 20 additions & 0 deletions scripts/ci/images/opensuse-tw/opensuse-tw-asan.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ghcr.io/ornladios/adios2:ci-opensuse-tw-sanitizer-base

# Install core dev packages
RUN zypper install -y --no-recommends libasan8 hdf5-devel && \
zypper clean --all

# Install ZFP
WORKDIR /opt/zfp
RUN curl -L https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz | tar -xvz && \
cmake -GNinja -S zfp-0.5.5 -B build \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/zfp/0.5.5 \
&& \
cmake --build build && \
cmake --install build && \
rm -rf zfp-0.5.5 build
ENV PATH=/opt/zfp/0.5.5/bin:${PATH} \
LD_LIBRARY_PATH=/opt/zfp/0.5.5/lib64:${LD_LIBRARY_PATH} \
CMAKE_PREFIX_PATH=/opt/zfp/0.5.5:${CMAKE_PREFIX_PATH}
Loading

0 comments on commit 2121827

Please sign in to comment.