Skip to content

Commit

Permalink
Update sanitizer CI job (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau authored Jan 5, 2025
1 parent f149b49 commit cb4f4d5
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ jobs:
export CC=${{matrix.backend.c_compiler}}
export CXX=${{matrix.backend.cxx_compiler}}
export DDC_CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -pedantic-errors ${{matrix.backend.ddc_extra_cxx_flags}}"
if [ 'xcpu-g++-Debug' = 'x${{matrix.backend.name}}-${{matrix.backend.cxx_compiler}}-${{matrix.cmake_build_type}}' ]
then
export DDC_CXXFLAGS="$DDC_CXXFLAGS -fno-omit-frame-pointer -fsanitize=address"
fi
cmake \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DBENCHMARK_ENABLE_GTEST_TESTS=OFF \
Expand Down Expand Up @@ -258,7 +252,7 @@ jobs:
rm -rf build
cmake \
-DCMAKE_CXX_FLAGS="$DDC_CXXFLAGS" \
-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-sign-compare -pedantic-errors ${{matrix.backend.ddc_extra_cxx_flags}}" \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DDDC_BUILD_BENCHMARKS=ON \
-DDDC_benchmark_DEPENDENCY_POLICY=INSTALLED \
Expand Down Expand Up @@ -302,17 +296,18 @@ jobs:
with:
report_paths: '/home/runner/work/ddc/ddc/tests.xml'

test-with-sanitizer-undefined:
test-with-sanitizer:
strategy:
fail-fast: false
matrix:
image: ['oldest']
image: ['latest']
backend:
- name: 'cpu'
c_compiler: 'clang'
cxx_compiler: 'clang++'
c_compiler: 'gcc'
cxx_compiler: 'g++'
cxx_version: ['17']
cmake_build_type: ['Debug']
sanitizer: ['address', 'undefined']
runs-on: ubuntu-latest
needs: [docker-build, id_repo]
steps:
Expand All @@ -333,12 +328,19 @@ jobs:
run: |
docker load < ${{matrix.image}}_${{matrix.backend.name}}.tar
rm ${{matrix.image}}_${{matrix.backend.name}}.tar
- name: Generate undefined sanitizer environment
if: ${{matrix.sanitizer}} == 'undefined'
run: |
cat<<-'UBSAN_SUPP_EOF' > ubsan.supp
vptr:ginkgo/core/solver/solver_base.hpp
UBSAN_SUPP_EOF
cat<<-'SANITIZER_ENV_EOF' > sanitizer_env.sh
export UBSAN_OPTIONS=print_stacktrace=1,halt_on_error=1,suppressions=/src/ubsan.supp
SANITIZER_ENV_EOF
- name: Test
id: test
run: |
cat<<-'UBSAN_EOF' > ubsan.supp
vptr:ginkgo/core/solver/solver_base.hpp
UBSAN_EOF
cat<<-'EOF' > run.sh
set -xe
git config --global --add safe.directory '*'
Expand All @@ -350,7 +352,7 @@ jobs:
export CXX=${{matrix.backend.cxx_compiler}}
cmake \
-DCMAKE_CXX_FLAGS="-fsanitize=undefined -fno-omit-frame-pointer" \
-DCMAKE_CXX_FLAGS="-fsanitize=${{matrix.sanitizer}} -fno-omit-frame-pointer" \
-DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \
-DDDC_BUILD_BENCHMARKS=ON \
-DKokkos_ENABLE_DEPRECATED_CODE_4=OFF \
Expand All @@ -359,7 +361,10 @@ jobs:
-S /src
cmake --build build
export UBSAN_OPTIONS=print_stacktrace=1,halt_on_error=1,suppressions=/src/ubsan.supp
if [ -f /src/sanitizer_env.sh ];
then
. /src/sanitizer_env.sh
fi
ctest --test-dir build --output-on-failure --timeout 10 --output-junit tests.xml
./build/examples/characteristics_advection
Expand Down

0 comments on commit cb4f4d5

Please sign in to comment.