[asterisk-commits] sgriepentrog: branch sgriepentrog/testsuite-valgrind r4357 - in /asterisk/tea...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 22 16:35:58 CST 2013


Author: sgriepentrog
Date: Fri Nov 22 16:35:55 2013
New Revision: 4357

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4357
Log:
Fixed problem with suppressions not working while gen-supp enabled
Eliminated xml parse error with no gen-supp

Modified:
    asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp
    asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py
    asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py
    asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py

Modified: asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp?view=diff&rev=4357&r1=4356&r2=4357
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp Fri Nov 22 16:35:55 2013
@@ -1,35 +1,39 @@
+#
+# _dl_close errors
+#
 
 {
-   <insert_a_suppression_name_here>
-   Memcheck:Cond
-   fun:_ast_sockaddr_port
-   fun:ast_find_ourip
-   fun:load_module
-   fun:start_resource
-   fun:load_resource_list
-   fun:load_modules
-   fun:main
+   dlclose-1
+   Memcheck:Addr1
+   fun:...
+   fun:dlclose
+   fun:load_dynamic_module
+   fun:...
+}
+{
+   dlclose-2
+   Memcheck:Addr2
+   fun:...
+   fun:dlclose
+   fun:load_dynamic_module
+   fun:...
+}
+{
+   dlclose-4
+   Memcheck:Addr4
+   fun:...
+   fun:dlclose
+   fun:load_dynamic_module
+   fun:...
 }
 
 {
-   <insert_a_suppression_name_here>
-   Memcheck:Cond
-   fun:_ast_sockaddr_port
-   fun:ast_find_ourip
-   fun:load_module
-   fun:start_resource
-   fun:load_resource_list
-   fun:load_modules
-   fun:main
-}
-
-{
-   <insert_a_suppression_name_here>
+   speex_decode1
    Memcheck:Cond
    fun:speex_decode_int
    fun:speextolin_framein
    fun:framein
-   fun:calc_cost
+   fun:generate_computational_cost
    fun:__ast_register_translator
    fun:load_module
    fun:start_resource
@@ -39,12 +43,13 @@
 }
 
 {
-   <insert_a_suppression_name_here>
+   speex_decode2
    Memcheck:Cond
+   fun:floor
    fun:speex_decode_int
    fun:speextolin_framein
    fun:framein
-   fun:calc_cost
+   fun:generate_computational_cost
    fun:__ast_register_translator
    fun:load_module
    fun:start_resource
@@ -52,3 +57,5 @@
    fun:load_modules
    fun:main
 }
+
+

Modified: asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py?view=diff&rev=4357&r1=4356&r2=4357
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py Fri Nov 22 16:35:55 2013
@@ -99,6 +99,7 @@
         self._ami_callbacks = []
         self._pcap_callbacks = []
         self.valgrind = False
+        self.valgrind_gensupp = False
 
         """ Pull additional configuration from YAML config if possible """
         if test_config and 'reactor-timeout' in test_config:
@@ -134,6 +135,8 @@
         if True == self.valgrind:
             self.reactor_timeout *= 5
             logger.info("Adjusting reactor timeout to %d for valgrind" % self.reactor_timeout)
+            if os.getenv("VALGRINDGENSUPP") == "true":
+                self.valgrind_gensupp = True
             if TestSuiteUtils.which('valgrind') is None:
                 logger.error("VALGRIND IS NOT INSTALLED - running test without it")
                 self.valgrind = False
@@ -200,6 +203,7 @@
             host = "127.0.0.%d" % (c + 1)
             self.ast.append(Asterisk(base=self.base, host=host))
             self.ast[c].valgrind = self.valgrind
+            self.ast[c].valgrind_gensupp = self.valgrind_gensupp
 
             """ If a base configuration for this Asterisk instance has been
             provided, install it first"""

Modified: asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py?view=diff&rev=4357&r1=4356&r2=4357
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py Fri Nov 22 16:35:55 2013
@@ -25,6 +25,7 @@
 from twisted.internet import reactor, protocol, defer, utils, error
 
 logger = logging.getLogger(__name__)
+
 
 class AsteriskCliCommand():
     """
@@ -87,6 +88,7 @@
         self.exitcode = code
         self.output = out
         self.err = err
+
 
 class AsteriskProtocol(protocol.ProcessProtocol):
     """
@@ -142,6 +144,7 @@
             logger.warning("Asterisk %s stop deferred already called" % self.__host)
         self.exited = True
 
+
 class Asterisk:
     """An instance of Asterisk.
 
@@ -306,7 +309,13 @@
             self.valgrind_xml_filename = os.path.join(self.base, "valgrind.xml")
             self.valgrind_supp_filename = os.path.join(self.base, "etc/asterisk/valgrind.supp")
 
-            if os.path.exists(self.valgrind_supp_filename):
+            # cannot both generate suppression file and use suppressions
+            if self.valgrind_gensupp:
+                logger.info("Generating suppression file")
+                self.cmd = [ "--gen-suppressions=all" ] + self.cmd
+                # suppression tags discovered in xml are written to ast#/valgrind.supp
+
+            elif os.path.exists(self.valgrind_supp_filename):
                 logger.info("Using the valgrind suppression file %s" % (self.valgrind_supp_filename))
                 self.cmd = [ "--suppressions=%s" % (self.valgrind_supp_filename) ] + self.cmd
 
@@ -319,8 +328,8 @@
                 "--leak-check=full",
 #                "--show-possibly-list=no",
 #                "--show-reachable=yes",
-                "--gen-suppressions=all",
             ] + self.cmd
+
 
         logger.info("Executing: %s" % (self.cmd))
 

Modified: asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py?view=diff&rev=4357&r1=4356&r2=4357
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py Fri Nov 22 16:35:55 2013
@@ -198,6 +198,7 @@
         count_error_kinds = {}
         code = {}
         supp = []
+
         try:
             error_list = xmldoc.getElementsByTagName('error')
             count_errors_found = len(error_list)
@@ -228,9 +229,9 @@
                 obj = getText(frame.getElementsByTagName('obj'))
 
                 if "" == file:
-                    codefile = "{" + obj + "} " + fn + "()"
+                    codefile = "{" + obj + "}: " + fn + "()"
                 else:
-                    codefile = dir + "/" + file + " " + fn + "()"
+                    codefile = dir + "/" + file + ": " + fn + "()"
 
                 errortag = error + " at line " + line
 
@@ -270,13 +271,17 @@
                     count_error_kinds[kind] = 0
                 count_error_kinds[kind] += 1
 
-                suppression = error.getElementsByTagName('suppression')[0]
-                rawtext = getData(suppression.getElementsByTagName('rawtext'))
-                if rawtext != "":
-                    supp.append(rawtext)
+                suppressions = error.getElementsByTagName('suppression')
+                if len(suppressions):
+                    suppression = suppressions[0]
+                    rawtext = getData(suppression.getElementsByTagName('rawtext'))
+                    if rawtext != "":
+                        supp.append(rawtext)
 
         except Exception, e:
-            print "Exception checking elements valgrind XML: %s" % (e)
+            msg = "Exception interpreting XML: %s" % (e)
+            self.stdout += msg + "\n"
+            print msg
             self.passed = False
 
         def dump_code_errors(tree, depth):
@@ -604,6 +609,9 @@
     parser.add_option("--valgrind", action="store_true",
             dest="valgrind", default=False,
             help="Run Asterisk under valgrind")
+    parser.add_option("--valgrind-gensupp", action="store_true",
+            dest="valgrind_gensupp", default=False,
+            help="Generate suppression file for valgrind")
     (options, args) = parser.parse_args(argv)
 
     ast_version = AsteriskVersion(options.version)
@@ -625,6 +633,9 @@
 
     if options.valgrind:
         os.environ["VALGRIND"] = "true"
+    if options.valgrind_gensupp:
+        os.environ["VALGRINDGENSUPP"] = "true"
+
     print "Running tests for Asterisk %s ...\n" % str(ast_version)
 
     test_suite.run()




More information about the asterisk-commits mailing list