From d9ea4e9b6ef65816d1c728c58e9c21874ae8f577 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sun, 26 Apr 2015 23:26:11 +0200 Subject: [PATCH] ensure clean valgrind run --- Makefile | 5 ++- test/unit/run.cpp | 19 +++++++++ test/unit/valgrind.supp | 90 +++++++++++++++++++++++++++++++---------- 3 files changed, 90 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 5e62659da..c279c584b 100755 --- a/Makefile +++ b/Makefile @@ -79,13 +79,14 @@ pep8: @pep8 -r --select=W391 -q --filename=*.py `pwd`/tests/ | xargs gsed -i -e :a -e '/^\n*$$/{$$d;N;ba' -e '}' @pep8 -r --select=W391 -q --filename=*.py `pwd`/tests/ | xargs ged -i '/./,/^$$/!d' +# note: pass --gen-suppressions=yes to create new suppression entries grind: @source localize.sh && source mapnik-settings.env && \ for FILE in test/standalone/*-bin; do \ - valgrind --leak-check=full --log-fd=1 $${FILE} | grep definitely; \ + valgrind --suppressions=./test/unit/valgrind.supp --leak-check=full --log-fd=1 $${FILE} | grep definitely; \ done @source localize.sh && source mapnik-settings.env && \ - valgrind --leak-check=full --log-fd=1 ./test/unit/run | grep definitely + valgrind --suppressions=./test/unit/valgrind.supp --leak-check=full --log-fd=1 ./test/unit/run | grep definitely; render: @for FILE in tests/data/good_maps/*xml; do \ diff --git a/test/unit/run.cpp b/test/unit/run.cpp index 613c3adb2..381efb104 100644 --- a/test/unit/run.cpp +++ b/test/unit/run.cpp @@ -2,6 +2,12 @@ #include "catch.hpp" #include // for xmlInitParser(), xmlCleanupParser() +#include +#include + +#ifdef MAPNIK_USE_PROJ4 +#include +#endif int main (int argc, char* const argv[]) { @@ -13,5 +19,18 @@ int main (int argc, char* const argv[]) // http://xmlsoft.org/xmlmem.html xmlCleanupParser(); + // http://cairographics.org/manual/cairo-Error-handling.html#cairo-debug-reset-static-data + cairo_debug_reset_static_data(); + + // http://icu-project.org/apiref/icu4c/uclean_8h.html#a93f27d0ddc7c196a1da864763f2d8920 + u_cleanup(); + +#ifdef MAPNIK_USE_PROJ4 + // http://trac.osgeo.org/proj/ticket/149 + pj_clear_initcache(); + // https://trac.osgeo.org/proj/wiki/ProjAPI#EnvironmentFunctions + pj_deallocate_grids(); +#endif + return result; } diff --git a/test/unit/valgrind.supp b/test/unit/valgrind.supp index 2f6d70bd7..51abafc71 100644 --- a/test/unit/valgrind.supp +++ b/test/unit/valgrind.supp @@ -1,31 +1,77 @@ { - dl_error1 - Memcheck:Cond - fun:index - fun:expand_dynamic_string_token - fun:fillin_rpath - fun:_dl_init_paths - fun:dl_main - fun:_dl_sysdep_start - fun:_dl_start + catch1 + Memcheck:Addr1 + fun:strlen + fun:_ZL29____C_A_T_C_H____T_E_S_T____9v + fun:_ZN5Catch10RunContext20invokeActiveTestCaseEv + fun:_ZN5Catch10RunContext14runCurrentTestERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES8_ + fun:_ZN5Catch10RunContext7runTestERKNS_8TestCaseE + fun:_ZN5Catch6Runner8runTestsEv + fun:_ZN5Catch7Session3runEv + fun:main } { - dl_error2 + catch2 Memcheck:Cond - fun:index - fun:expand_dynamic_string_token - fun:_dl_map_object - fun:map_doit - fun:_dl_catch_error - fun:do_preload - fun:dl_main - fun:_dl_sysdep_start - fun:_dl_start + fun:_platform_memchr$VARIANT$Haswell + fun:__sfvwrite + fun:fwrite + fun:_ZNSt3__111__stdoutbufIcE8overflowEi + fun:_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6xsputnEPKcl + fun:_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_ + fun:_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m + fun:_ZN5Catch15ConsoleReporter11printTotalsERKNS_6TotalsE + fun:_ZN5Catch15ConsoleReporter12testRunEndedERKNS_12TestRunStatsE + fun:_ZN5Catch10RunContextD2Ev + fun:_ZN5Catch6Runner8runTestsEv + fun:_ZN5Catch7Session3runEv } { - tmpfile + catch3 + Memcheck:Cond + fun:_platform_memchr$VARIANT$Haswell + fun:__sfvwrite + fun:fwrite + fun:_ZNSt3__111__stdoutbufIcE8overflowEi + fun:_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6xsputnEPKcl + fun:_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_ + fun:_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m + fun:_ZN5Catch12_GLOBAL__N_115PosixColourImpl3useENS_6Colour4CodeE + fun:_ZN5Catch6Colour3useENS0_4CodeE + fun:_ZN5Catch15ConsoleReporter18printTotalsDividerERKNS_6TotalsE + fun:_ZN5Catch15ConsoleReporter12testRunEndedERKNS_12TestRunStatsE + fun:_ZN5Catch10RunContextD2Ev +} +{ + catch4 + Memcheck:Cond + fun:_platform_memchr$VARIANT$Haswell + fun:__sfvwrite + fun:fwrite + fun:_ZNSt3__111__stdoutbufIcE8overflowEi + fun:_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6xsputnEPKcl + fun:_ZNSt3__116__pad_and_outputIcNS_11char_traitsIcEEEENS_19ostreambuf_iteratorIT_T0_EES6_PKS4_S8_S8_RNS_8ios_baseES4_ + fun:_ZNSt3__124__put_character_sequenceIcNS_11char_traitsIcEEEERNS_13basic_ostreamIT_T0_EES7_PKS4_m + fun:_ZN5Catch15ConsoleReporter18printTotalsDividerERKNS_6TotalsE + fun:_ZN5Catch15ConsoleReporter12testRunEndedERKNS_12TestRunStatsE + fun:_ZN5Catch10RunContextD2Ev + fun:_ZN5Catch6Runner8runTestsEv + fun:_ZN5Catch7Session3runEv +} +{ + pixman Memcheck:Leak + match-leak-kinds: definite fun:malloc - fun:fdopen@@GLIBC_* - fun:tmpfile@@GLIBC_* + fun:_pixman_implementation_create + fun:_pixman_implementation_create_general + fun:_pixman_choose_implementation + fun:pixman_constructor + fun:_ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE + fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE + fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE + fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE + fun:_ZN11ImageLoader19processInitializersERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE + fun:_ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE + fun:_ZN4dyld24initializeMainExecutableEv }