tests: Add valgrind and Leak Sanitizer suppression files.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 17 Jan 2019 03:08:46 +0000 (19:08 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 17 Jan 2019 03:49:58 +0000 (19:49 -0800)
Otherwise any of the tests that use Cairo for PDF output end up with a
bunch of leaks due to libfontconfig weirdness.

tests/atlocal.in
tests/automake.mk
tests/lsan.supp [new file with mode: 0644]
tests/valgrind.supp [new file with mode: 0644]

index 2a8a0eafbe014bc008ffaf06f39f33642f40a6cf..da7707139c8f753df5cfcf0c519141254b42e8ad 100644 (file)
@@ -76,3 +76,7 @@ if test X"$RUNNER" = Xwine; then
         $pspp_diff -w  "$@"
     }
 fi
+
+# Enable leak suppressions for Address Sanitizer/Leak Sanitizer.
+LSAN_OPTIONS="suppressions=$abs_top_srcdir/tests/lsan.supp print_suppressions=0"
+export LSAN_OPTIONS
index 116e32c217406bbbe677ca5106300805ddf7d835..50525848f0f4ca66b3cea3c439d1d1466a76361e 100644 (file)
@@ -468,9 +468,10 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
        } >'$(srcdir)/package.m4'
 
 check-valgrind:
-       $(MAKE) check RUNNER='$(SHELL) $(abs_top_builddir)/libtool --mode=execute valgrind --log-file=valgrind.%p --leak-check=full --num-callers=20' TESTSUITEFLAGS='$(TESTSUITEFLAGS) -d'
+       $(MAKE) check RUNNER='$(SHELL) $(abs_top_builddir)/libtool --mode=execute valgrind --log-file=valgrind.%p --leak-check=full --num-callers=20 --suppressions=$(abs_top_srcdir)/tests/valgrind.supp --read-inline-info=yes --read-var-info=yes' TESTSUITEFLAGS='$(TESTSUITEFLAGS) -d'
        @echo
        @echo '--------------------------------'
        @echo 'Valgrind output is in:'
        @echo 'tests/testsuite.dir/*/valgrind.*'
        @echo '--------------------------------'
+EXTRA_DIST += tests/valgrind.supp tests/lsan.supp
diff --git a/tests/lsan.supp b/tests/lsan.supp
new file mode 100644 (file)
index 0000000..8fceb61
--- /dev/null
@@ -0,0 +1 @@
+leak:libfontconfig
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
new file mode 100644 (file)
index 0000000..b2423ba
--- /dev/null
@@ -0,0 +1,22 @@
+# libfontconfig uses offsets instead of pointers so valgrind doesn't
+# recognize when blocks are still in use
+{
+    fontconfig
+    Memcheck:Leak
+    ...
+    fun:FcFontRenderPrepare
+}
+{
+    fontconfig2
+    Memcheck:Leak
+    fun:realloc
+    obj:*libfontconfig.so.*
+}
+{
+    fontconfig3
+    Memcheck:Leak
+    fun:malloc
+    obj:*libfontconfig.so.*
+    ...
+    fun:XML_ParseBuffer
+}