@@ -243,3 +243,61 @@ jobs:
243243 pytest --pyargs pywt
244244 fi
245245 popd
246+
247+ clang_ASan_UBSan :
248+ name : Test under ASan and UBSan
249+ runs-on : macos-latest
250+ steps :
251+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
252+ with :
253+ submodules : recursive
254+ fetch-tags : true
255+ persist-credentials : false
256+
257+ - name : Set up pyenv
258+ run : |
259+ git clone https://github.com/pyenv/pyenv.git "$HOME/.pyenv"
260+ PYENV_ROOT="$HOME/.pyenv"
261+ PYENV_BIN="$PYENV_ROOT/bin"
262+ PYENV_SHIMS="$PYENV_ROOT/shims"
263+ echo "$PYENV_BIN" >> $GITHUB_PATH
264+ echo "$PYENV_SHIMS" >> $GITHUB_PATH
265+ echo "PYENV_ROOT=$PYENV_ROOT" >> $GITHUB_ENV
266+
267+ - name : Set up LLVM
268+ run : |
269+ brew install llvm@19
270+ LLVM_PREFIX=$(brew --prefix llvm@19)
271+ echo CC="$LLVM_PREFIX/bin/clang" >> $GITHUB_ENV
272+ echo CXX="$LLVM_PREFIX/bin/clang++" >> $GITHUB_ENV
273+ echo LDFLAGS="-L$LLVM_PREFIX/lib" >> $GITHUB_ENV
274+ echo CPPFLAGS="-I$LLVM_PREFIX/include" >> $GITHUB_ENV
275+
276+ - name : Build Python with AddressSanitizer
277+ run : |
278+ CONFIGURE_OPTS="--with-address-sanitizer" pyenv install 3.14
279+ pyenv global 3.14
280+
281+ - name : Install NumPy dependencies from PyPI
282+ run : |
283+ pip install meson-python ninja cython
284+
285+ - name : Build NumPy with ASan
286+ run :
287+ pip install numpy --no-binary numpy --no-build-isolation -Csetup-args="-Db_sanitize=address" -v
288+
289+ - name : Install dependencies from PyPI
290+ run : |
291+ pip install spin pytest pytest-timeout
292+
293+ - name : Build PyWavelets with ASan and UBSan
294+ run : |
295+ export CFLAGS=-fno-sanitize=function # suppressed upstream, see cython#7437
296+ spin build -- -Db_sanitize=address,undefined -Db_lundef=false
297+
298+ - name : Test
299+ run : |
300+ # pass -s to pytest to see ASAN errors and warnings, otherwise pytest captures them
301+ ASAN_OPTIONS=detect_leaks=0:symbolize=1:strict_init_order=true:allocator_may_return_null=1:use_sigaltstack=0 \
302+ UBSAN_OPTIONS=halt_on_error=1 \
303+ spin test -- -v -s --timeout=600 --durations=10
0 commit comments