[pygobject] tests: Fix make check.valgrind



commit c89fa35814103a4ceefece8e305af4f9e0dd6a37
Author: Christoph Reiter <creiter src gnome org>
Date:   Sun Apr 2 10:57:34 2017 +0200

    tests: Fix make check.valgrind
    
    Got broken when we changed to use dbus-run-session. Move
    valgrind related env vars before the dbus launcher helper.
    
    This also tries to improve the lookup of the suppression file.
    Instead of relying on the basename of the python binary use the python
    major version to select one of two suppression files in the repo.
    
    Add PYTHONMALLOC=malloc when running under valgrind, which makes Python
    use malloc instead of its own allocator. Only works with Python 3.6+.

 configure.ac                           |    5 +-
 tests/Makefile.am                      |   22 +-
 tests/{python2.7.supp => python2.supp} |    0
 tests/python3.3dm.supp                 |  471 --------------------------------
 tests/{python3.3.supp => python3.supp} |    0
 5 files changed, 14 insertions(+), 484 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 595298b..aa9b52a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -142,8 +142,9 @@ AM_PATH_GLIB_2_0(glib_required_version,,[AC_MSG_ERROR(maybe you want the pygobje
 if test -n "$export_dynamic"; then
   GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"`
 fi
-PYTHON_BASENAME=`basename $PYTHON`
-AC_SUBST([PYTHON_BASENAME])
+
+PYTHON_VALGRIND_SUPP=`$PYTHON -c "import sys; sys.stdout.write('python' + sys.version.__getitem__(0))"`
+AC_SUBST([PYTHON_VALGRIND_SUPP])
 
 dnl libffi
 PKG_CHECK_MODULES(FFI, libffi >= 3.0)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fe4fa84..ff10433 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -168,8 +168,8 @@ check-local:
 # pygtkcompat tests need to be run in a separate process as they
 # clobber global name space
 check.real: $(target_libraries) $(test_typelibs) gschemas.compiled
-       $(RUN_TESTS_ENV_VARS) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
-       [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) 
$(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning 
-Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
+       $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; 
rc=$$?; \
+       [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS)  
$(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning 
-Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
        exit $$rc
 
 check.gdb:
@@ -180,17 +180,17 @@ check.nemiver:
 
 # Note G_SLICE in these check variations is intended to clobber the default set in RUN_TESTS_ENV_VARS
 check.valgrind:
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        " \
        $(MAKE) check
 
 check.valgrindlog:
        mkdir -p $(top_builddir)/tmp
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        --child-silent-after-fork=yes \
        --log-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.log \
        " \
@@ -198,9 +198,9 @@ check.valgrindlog:
 
 check.valgrindxml:
        mkdir -p $(top_builddir)/tmp
-       EXEC_NAME="G_SLICE=always-malloc G_DEBUG=gc-friendly \
-       valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
-       --suppressions=$(top_srcdir)/tests/$(PYTHON_BASENAME).supp \
+       EXTRA_ENV="G_SLICE=always-malloc G_DEBUG=gc-friendly PYTHONMALLOC=malloc" \
+       EXEC_NAME="valgrind --leak-check=full --show-possibly-lost=no --num-callers=20 \
+       --suppressions=$(top_srcdir)/tests/$(PYTHON_VALGRIND_SUPP).supp \
        --child-silent-after-fork=yes \
        --xml=yes --xml-file=$(top_builddir)/tmp/`git rev-parse HEAD | cut -c1-8`-$$TEST_NAMES.xml \
        " \
diff --git a/tests/python2.7.supp b/tests/python2.supp
similarity index 100%
rename from tests/python2.7.supp
rename to tests/python2.supp
diff --git a/tests/python3.3.supp b/tests/python3.supp
similarity index 100%
rename from tests/python3.3.supp
rename to tests/python3.supp


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]