Skip to content

Commit

Permalink
Merge branch 'develop' into keep_tmpdir
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl authored Dec 3, 2023
2 parents d0f5433 + 52b1af6 commit 2dca397
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 107 deletions.
230 changes: 147 additions & 83 deletions python/tests/valgrind-python.supp
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,28 @@
Memcheck:Leak
fun:malloc
...
fun:__pyx_pw_5numpy_6random_13bit_generator_12BitGenerator_1__init__
fun:__pyx_pw_5numpy_*
}

{
numpy
Memcheck:Leak
match-leak-kinds: definite
match-leak-kinds: possible
fun:malloc
obj:/usr/bin/python3.?
fun:PyUFunc_FromFuncAndDataAndSignatureAndIdentity
fun:initumath
fun:PyInit__multiarray_umath
...
}

{
numpy
Memcheck:Leak
match-leak-kinds: possible
fun:malloc
fun:default_malloc
fun:PyDataMem_UserNEW
...
fun:gentype_generic_method
}

#
Expand Down Expand Up @@ -178,26 +189,26 @@
{
other
Memcheck:Cond
obj:/usr/bin/python3.?
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
obj:/usr/bin/python3.*
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
fun:_PyEval_EvalCodeWithName
fun:_PyFunction_Vectorcall
fun:_PyEval_EvalFrameDefault
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
fun:_PyEval_EvalFrameDefault
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
}

{
other
Memcheck:Value8
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
fun:__Pyx_PyObject_Call
fun:__Pyx__PyObject_CallOneArg
}
Expand Down Expand Up @@ -308,7 +319,7 @@
...
fun:PyBytes_Repr
fun:PyObject_Str
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
fun:PyObject_Format
...
Expand Down Expand Up @@ -382,9 +393,9 @@
{
other
Memcheck:Cond
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
fun:__Pyx_PyObject_Call
fun:__Pyx__PyObject_CallOneArg
...
Expand All @@ -410,9 +421,9 @@
other
Memcheck:Cond
...
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
fun:_PyObject_CallMethodIdObjArgs
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
}

Expand All @@ -437,9 +448,9 @@
other
Memcheck:Value8
...
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
fun:_PyObject_CallMethodIdObjArgs
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
}

Expand All @@ -455,74 +466,52 @@
other
Memcheck:Value8
...
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
fun:PyDict_SetItem
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
}

{
other
Memcheck:Cond
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
}

{
other
Memcheck:Cond
fun:realloc
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
fun:_PyFunction_Vectorcall
}

{
other
Memcheck:Value8
obj:/usr/bin/python3.?
obj:/usr/bin/python3.*
...
obj:/usr/bin/python3.?
}

{
other
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.?
fun:_PyObject_MakeTpCall
obj:/usr/bin/python3.*
}

{
other
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.?
obj:/usr/bin/python3.?
Memcheck:Value8
obj:/usr/bin/python3.*
fun:_PyObject_MakeTpCall
}

{
other
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.?
...
fun:PyTuple_New
...
}

{
other
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.?
fun:PyList_AsTuple
fun:_PyEval_EvalFrameDefault
obj:/usr/bin/python3.11
obj:/usr/bin/python3.11
obj:/usr/bin/python3.11
fun:PyIter_Next
obj:/usr/bin/python3.11
fun:PyBytes_FromObject
obj:/usr/bin/python3.11
obj:/usr/bin/python3.11
fun:PyObject_Vectorcall
}

{
Expand All @@ -544,7 +533,6 @@
{
Pandas
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
...
obj:*site-packages/pandas/_libs/*.cpython-3*-x86_64-linux-gnu.so
Expand All @@ -561,30 +549,6 @@
...
}


{
PyTuple_Pack
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.*
fun:PyTuple_Pack
obj:/usr/bin/python3.*
...
}

{
PyAST_CompileObject
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.*
...
fun:PyAST_CompileObject
obj:/usr/bin/python3.*
...
}

{
other
Memcheck:Value8
Expand Down Expand Up @@ -775,3 +739,103 @@
fun:os_stat
...
}

{
Python PyLong_FromUnicodeObject
Memcheck:Cond
fun:PyLong_FromString
fun:PyLong_FromUnicodeObject
}

{
Python PyLong_FromUnicodeObject
Memcheck:Value8
fun:PyLong_FromString
fun:PyLong_FromUnicodeObject
}

{
Python
Memcheck:Leak
match-leak-kinds: possible
fun:realloc
obj:/usr/bin/python3.*
fun:_PyEval_EvalFrameDefault
fun:_PyFunction_Vectorcall
}

{
Python
Memcheck:Leak
match-leak-kinds: possible
fun:calloc
fun:PyList_New
fun:_PyEval_EvalFrameDefault
fun:_PyFunction_Vectorcall
...
}

{
Python
Memcheck:Leak
match-leak-kinds: possible
fun:malloc
fun:PyModule_ExecDef
obj:/usr/bin/python3.*
...
}

{
Python
Memcheck:Leak
match-leak-kinds: possible
fun:malloc
obj:/usr/bin/python3.*
...
}

{
Python
Memcheck:Addr32
fun:__wcsncpy_avx2
fun:_Py_wgetcwd
obj:/usr/bin/python3.*
fun:Py_RunMain
fun:Py_BytesMain
fun:(below main)
}

{
Python
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/bin/python3.*
...
}

{
Python
Memcheck:Leak
match-leak-kinds: definite
fun:*alloc
fun:_PyObject_GC_*
obj:/usr/bin/python3.*
}


{
Antimony with libsbml 5.20.1
Memcheck:Leak
match-leak-kinds: definite
fun:_Znwm
fun:_ZN7libsbml12SBMLDocument14getAllElementsEPNS_13ElementFilterE
fun:_ZN7libsbml23CompFlatteningConverter21unsetExplicitlyListedEv
fun:_ZN7libsbml23CompFlatteningConverter17performConversionEv
fun:_ZN7libsbml23CompFlatteningConverter7convertEv
fun:_ZN7libsbml22CompSBMLDocumentPlugin16checkConsistencyEv
fun:_ZN7libsbml12SBMLDocument16checkConsistencyEv
...
fun:loadAntimonyString
...
}
33 changes: 21 additions & 12 deletions scripts/run-valgrind-py.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Test python model wrapping inside virtual environment
# Without arguments: run Python test suite under valgrind
# With arguments: run whatever was passed as arguments under valgrind

script_path=$(dirname $BASH_SOURCE)
amici_path=$(cd "$script_path"/.. && pwd)
Expand All @@ -9,23 +10,31 @@ set -e
if [[ -z "${BNGPATH}" ]]; then
export BNGPATH=${amici_path}/ThirdParty/BioNetGen-2.7.0
fi
suppressions="${amici_path}/python/tests/valgrind-python.supp"
if [ $# -eq 0 ]
then
# No arguments supplied, run all tests
cd "${amici_path}"/python/tests
source "${amici_path}"/build/venv/bin/activate
pip install scipy h5py pytest pytest-rerunfailures
command=(python -m pytest -vv --ignore-glob=*petab* -W 'ignore:Signature ')
# ^ ignores the following warning that occurs only under valgrind,
# e.g. `valgrind python -c "import h5py"`:
# UserWarning: Signature b'\x00\xd0\xcc\xcc\xcc\xcc\xcc\xcc\xfb\xbf\x00\x00\x00\x00\x00\x00'
# for <class 'numpy.longdouble'> does not match any known type: falling back to type probe function.
else
# Run whatever was passed as arguments
command=($@)
fi

cd "${amici_path}"/python/tests

source "${amici_path}"/build/venv/bin/activate

pip install scipy h5py pytest pytest-rerunfailures

set -x
PYTHONMALLOC=malloc valgrind \
--suppressions=valgrind-python.supp \
--suppressions="${suppressions}" \
--show-leak-kinds=definite \
--errors-for-leak-kinds=definite \
--error-exitcode=1 \
--leak-check=full \
--gen-suppressions=all \
-v \
python -m pytest -vv --ignore-glob=*petab* -W "ignore:Signature "
# ^ ignores the following warning that occurs only under valgrind,
# e.g. `valgrind python -c "import h5py"`:
# UserWarning: Signature b'\x00\xd0\xcc\xcc\xcc\xcc\xcc\xcc\xfb\xbf\x00\x00\x00\x00\x00\x00'
# for <class 'numpy.longdouble'> does not match any known type: falling back to type probe function.
"${command[@]}"
Loading

0 comments on commit 2dca397

Please sign in to comment.