Skip to content

Commit

Permalink
GitHub CI: Test with AddressSanitizer (kokkos#6676)
Browse files Browse the repository at this point in the history
* GitHub CI: Test with AddressSanitizer

* Disable view_allocation_error when running with AddressSanitizer

* Try  __attribute__((no_sanitize(address)))

* Revert "Try  __attribute__((no_sanitize(address)))"

This reverts commit 335f7f2.
  • Loading branch information
masterleinad committed Jan 4, 2024
1 parent f485cfa commit 654a51f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ jobs:
backend: 'OPENMP'
- distro: 'ubuntu:latest'
cxx: 'clang++'
cxx_extra_flags: '-fsanitize=address'
extra_linker_flags: '-fsanitize=address'
cmake_build_type: 'RelWithDebInfo'
backend: 'THREADS'
clang-tidy: '-DCMAKE_CXX_CLANG_TIDY="clang-tidy;-warnings-as-errors=*"'
- distro: 'ubuntu:latest'
cxx: 'clang++'
cxx_extra_flags: '-fsanitize=address'
extra_linker_flags: '-fsanitize=address'
cmake_build_type: 'RelWithDebInfo'
backend: 'SERIAL'
- distro: 'ubuntu:latest'
cxx: 'g++'
cmake_build_type: 'RelWithDebInfo'
Expand Down Expand Up @@ -106,6 +114,7 @@ jobs:
-DKokkos_ENABLE_COMPILER_WARNINGS=ON \
-DKokkos_ENABLE_IMPL_MDSPAN=ON \
-DCMAKE_CXX_FLAGS="-Werror ${{ matrix.cxx_extra_flags }}" \
-DCMAKE_EXE_LINKER_FLAGS="${{ matrix.extra_linker_flags }}" \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}
Expand All @@ -118,6 +127,7 @@ jobs:
working-directory: builddir
run: ctest --output-on-failure
- name: Test linking against build dir
if: ${{ matrix.cxx_extra_flags != '-fsanitize=address' }}
working-directory: example/build_cmake_installed
run: |
cmake -B builddir_buildtree -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DKokkos_ROOT=../../builddir
Expand All @@ -128,6 +138,7 @@ jobs:
- name: Install
run: sudo cmake --build builddir --target install
- name: Test install
if: ${{ matrix.cxx_extra_flags != '-fsanitize=address' }}
working-directory: example/build_cmake_installed
run: |
cmake -B builddir -DCMAKE_CXX_COMPILER=${{ matrix.cxx }}
Expand Down
6 changes: 6 additions & 0 deletions core/unit_test/TestViewAPI_d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ TEST(TEST_CATEGORY, view_api_d) {
}

TEST(TEST_CATEGORY, view_allocation_error) {
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
GTEST_SKIP() << "AddressSanitzer detects allocating too much memory "
"preventing our checks to run";
#endif
#endif
#if ((HIP_VERSION_MAJOR == 5) && (HIP_VERSION_MINOR == 3))
GTEST_SKIP() << "ROCm 5.3 segfaults when trying to allocate too much memory";
#endif
Expand Down

0 comments on commit 654a51f

Please sign in to comment.