With this configure option, "make fate" executes all programs with
valgrind.  This option optionally takes as parameter the complete path
and command line for invoking the valgrind program. For use in the FATE
environment, use "./configure --valgrind='valgrind --error-exitcode=1'"

Patch based on work by: Reimar Doeffinger <[email protected]>
cherry picked from commits 77b90f0cd0b702b9ffff55d8612ef8b487705fd6 and
d41c824b233292d7e5314a7029fab8cf554a9b2b
---
 configure                |    8 ++++++++
 tests/fate-valgrind.supp |   31 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 tests/fate-valgrind.supp

diff --git a/configure b/configure
index 471240c..3f6c790 100755
--- a/configure
+++ b/configure
@@ -278,6 +278,10 @@ Developer options (useful when working on Libav itself):
   --enable-debug=LEVEL     set the debug level [$debuglevel]
   --disable-optimizations  disable compiler optimizations
   --enable-extra-warnings  enable more compiler warnings
+  --valgrind=VALGRIND      run "make fate" tests through valgrind to detect 
memory
+                           leaks and errors, using the specified valgrind 
binary
+                           (and optionally extra arguments).
+                           NB: Cannot be combined with --target-exec.
   --samples=PATH           location of test samples for FATE, if not set use
                            \$LIBAV_SAMPLES at make invocation time.
   --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
@@ -1396,6 +1400,7 @@ CMDLINE_SET="
     target_os
     target_path
     toolchain
+    valgrind
 "
 
 CMDLINE_APPEND="
@@ -3594,6 +3599,9 @@ fi
 
 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
 
+test -n "$valgrind" &&
+   target_exec="${valgrind##--} --malloc-fill=0x2a --track-origins=yes 
--leak-check=full --gen-suppressions=all 
--suppressions=$source_path/tests/fate-valgrind.supp"
+
 # add some useful compiler flags if supported
 check_cflags -Wdeclaration-after-statement
 check_cflags -Wall
diff --git a/tests/fate-valgrind.supp b/tests/fate-valgrind.supp
new file mode 100644
index 0000000..db72c54
--- /dev/null
+++ b/tests/fate-valgrind.supp
@@ -0,0 +1,31 @@
+# seems fixed in newer versions
+# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=577135
+{
+   zlib-inflate
+   Memcheck:Cond
+   fun:inflateReset2
+   fun:inflateInit2_
+}
+# libc overreads on purpose
+# http://sourceware.org/bugzilla/show_bug.cgi?id=12424
+{
+   eval-strtod
+   Memcheck:Addr8
+   fun:__GI___strncasecmp_l
+   fun:____strtod_l_internal
+   fun:av_strtod
+}
+{
+   eval-strtod
+   Memcheck:Value8
+   fun:__GI___strncasecmp_l
+   fun:____strtod_l_internal
+   fun:av_strtod
+}
+{
+   eval-strtod
+   Memcheck:Cond
+   fun:__GI___strncasecmp_l
+   fun:____strtod_l_internal
+   fun:av_strtod
+}
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to