launcher: try using gst.supp as valgrind suppressions file
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 19 Mar 2015 16:22:26 +0000 (17:22 +0100)
committerThibault Saunier <tsaunier@gnome.org>
Fri, 20 Mar 2015 09:34:49 +0000 (10:34 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=746465

validate/launcher/baseclasses.py

index 2d446e8..a7691ed 100644 (file)
@@ -34,6 +34,7 @@ import ConfigParser
 import loggable
 from loggable import Loggable
 import xml.etree.cElementTree as ET
+from gi.repository import GLib
 
 from utils import mkdir, Result, Colors, printc, DEFAULT_TIMEOUT, GST_SECOND, \
     Protocols
@@ -274,6 +275,9 @@ class Test(Loggable):
         if self.result is not Result.TIMEOUT:
             self.queue.put(None)
 
+    def get_valgrind_suppressions(self):
+        return None
+
     def use_valgrind(self):
         vg_args = [
             ('trace-children', 'yes'),
@@ -283,6 +287,10 @@ class Test(Loggable):
             ('num-callers', '20'),
         ]
 
+        supps = self.get_valgrind_suppressions()
+        if supps:
+            vg_args.append(('suppressions', supps))
+
         self.command = "valgrind %s %s" % (' '.join(map(lambda x: '--%s=%s' % (x[0], x[1]), vg_args)),
                                            self.command)
 
@@ -555,6 +563,21 @@ class GstValidateTest(Test):
 
         return position
 
+    def get_valgrind_suppressions(self):
+        # Are we running from sources?
+        root_dir = os.path.abspath(os.path.dirname(os.path.join(os.path.dirname(os.path.abspath(__file__)))))
+        p = os.path.join(root_dir, 'common', 'gst.supp')
+        if os.path.exists(p):
+            return p
+
+        # Look in system data dirs
+        for datadir in GLib.get_system_data_dirs():
+            p = os.path.join(datadir, 'gstreamer-1.0', 'validate', 'gst.supp')
+            if os.path.exists(p):
+                return p
+
+        return None
+
 
 class GstValidateEncodingTestInterface(object):
     DURATION_TOLERANCE = GST_SECOND / 4