Skip to content

Commit

Permalink
add valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Apr 29, 2024
1 parent adcbc77 commit 627e262
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,30 @@ test_python() {
show_info "Testing wheel"
python -m pytest -vv

if [ ${TEST_WITH_MEMCHECK} -gt 0 ]; then
show_info "Setup environment for Python/valgrind"

# To have more control over exactly which dependencies are available,
# set up a separate venv to run. Essentially, we check for leaks in
# all self-contained tests but not tests involving pyarrow or numpy.
VALGRIND_PYTHON_VENV="${NANOARROW_TMPDIR}/python/valgrind_venv"
python -m venv "${VALGRIND_PYTHON_VENV}"
source "${VALGRIND_PYTHON_VENV}/bin/activate"
python -m pip install --upgrade pip
python -m pip install pytest

# Ensure we have debug symbols for the build we pass to valgrind
export NANOARROW_DEBUG_EXTENSION=1
pip install -e .

show_info "Run Python tests with valgrind"
valgrind --tool=memcheck --leak-check=full --error-exitcode=1 \
--suppressions="${NANOARROW_SOURCE_DIR}/valgrind.supp" \
python -m pytest -vv

deactivate
fi

popd
}

Expand Down
29 changes: 29 additions & 0 deletions valgrind.supp
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,32 @@
...
fun:__tls_get_addr
}

{
<Python>:Handle PyMalloc confusing valgrind (possibly leaked)
Memcheck:Leak
fun:malloc
...
fun:_PyObject_GC_Resize
}

{
<Python>:Handle PyMalloc confusing valgrind (possibly leaked)
Memcheck:Leak
fun:realloc
fun:_PyObject_GC_Resize
}

{
<Python>:Handle PyMalloc confusing valgrind (possibly leaked)
Memcheck:Leak
fun:malloc
fun:_PyObject_GC_New
}

{
<Python>:Handle PyMalloc confusing valgrind (possibly leaked)
Memcheck:Leak
fun:malloc
fun:_PyObject_GC_NewVar
}

0 comments on commit 627e262

Please sign in to comment.