Skip to content

Commit 6191d98

Browse files
Reintroduce Clang Sanitizer (#947)
1 parent 939f397 commit 6191d98

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/ci/sanitizer/clang/Leak.supp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ leak:mca_pmix_pmix*
44
leak:libopen-pal*
55
leak:libopen-rte*
66
leak:libmpi*
7+
leak:libevent*
78
# CPython 3.7.1 and pybind11 2.3.0
89
leak:*py*
910
# 10 byte memleak in main of "make" 4.1
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This is a Spack environment file.
2+
#
3+
# Activating and installing this environment will provide all dependencies
4+
# that are needed for full-feature development.
5+
# https//spack.readthedocs.io/en/latest/environments.html#anonymous-environments
6+
#
7+
spack:
8+
specs:
9+
- adios
10+
- adios2
11+
- hdf5
12+
- openmpi
13+
14+
packages:
15+
hdf5:
16+
variants: ~mpi
17+
adios:
18+
variants: ~zfp ~sz ~lz4 ~blosc
19+
adios2:
20+
variants: ~zfp ~sz ~png ~dataman ~python ~fortran ~ssc ~shared ~bzip2
21+
cmake:
22+
externals:
23+
- spec: "cmake"
24+
prefix: /usr
25+
buildable: False
26+
openmpi:
27+
externals:
28+
- spec: "openmpi"
29+
prefix: /usr
30+
buildable: False
31+
perl:
32+
externals:
33+
- spec: "perl"
34+
prefix: /usr
35+
buildable: False
36+
python:
37+
externals:
38+
- spec: "python"
39+
prefix: /usr
40+
buildable: False
41+
all:
42+
target: ['x86_64']
43+
variants: ~fortran
44+
providers:
45+
mpi: [openmpi]
46+
compiler: [clang@10.0.0]
47+
48+
compilers:
49+
- compiler:
50+
environment: {}
51+
extra_rpaths: []
52+
flags: {}
53+
modules: []
54+
operating_system: ubuntu20.04
55+
paths:
56+
cc: /usr/lib/llvm-10/bin/clang
57+
cxx: /usr/lib/llvm-10/bin/clang++
58+
f77: /usr/bin/gfortran
59+
fc: /usr/bin/gfortran
60+
spec: clang@10.0.0
61+
target: x86_64
62+
63+
config:
64+
build_jobs: 2
65+

.github/workflows/unix.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,37 @@ jobs:
2828
cat clang-tidy.log
2929
if [[ $(wc -m <clang-tidy.log) -gt 1 ]]; then exit 1; fi
3030
31+
clangsanitizer10_nopy_ompi_h5_ad1_ad2:
32+
runs-on: ubuntu-20.04
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Spack Cache
36+
uses: actions/cache@v2
37+
with: {path: /opt/spack, key: clang10_nopy_ompi_h5_ad1_ad2 }
38+
- name: Install
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install clang-10 libc++-dev libc++abi-dev python3 gfortran libopenmpi-dev
42+
python3 -m pip install -U pip
43+
python3 -m pip install -U numpy
44+
sudo .github/workflows/dependencies/install_spack
45+
- name: Build
46+
env: {CC: mpicc, CXX: mpic++, OMPI_CC: clang-10, OMPI_CXX: clang++-10, CXXFLAGS: -Werror -Wno-deprecated-declarations}
47+
run: |
48+
eval $(spack env activate --sh .github/ci/spack-envs/clangtidy_nopy_ompi_h5_ad1_ad2/)
49+
spack install
50+
SOURCEPATH="$(pwd)"
51+
mkdir build && cd build
52+
../share/openPMD/download_samples.sh && chmod u-w samples/git-sample/*.h5
53+
export LDFLAGS="${LDFLAGS} -fsanitize=address,undefined -shared-libsan"
54+
CXXFLAGS="${CXXFLAGS} -fsanitize=address,undefined -shared-libsan"
55+
CXXFLAGS="${CXXFLAGS}" cmake -S .. -B . -DopenPMD_USE_MPI=ON -DopenPMD_USE_PYTHON=ON -DopenPMD_USE_HDF5=ON -DopenPMD_USE_ADIOS2=ON -DopenPMD_USE_ADIOS1=ON -DopenPMD_USE_INVASIVE_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE=ON
56+
cmake --build . --parallel 2
57+
export ASAN_OPTIONS=detect_stack_use_after_return=1:detect_leaks=1:check_initialization_order=true:strict_init_order=true:detect_stack_use_after_scope=1:fast_unwind_on_malloc=0
58+
export LSAN_OPTIONS=suppressions="$SOURCEPATH/.github/ci/sanitizer/clang/Leak.supp"
59+
export LD_PRELOAD=/usr/lib/clang/10/lib/linux/libclang_rt.asan-x86_64.so
60+
ctest --output-on-failure
61+
3162
clang5_nopy_nompi_h5:
3263
runs-on: ubuntu-18.04
3364
steps:

0 commit comments

Comments
 (0)