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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 3 10:35:28 CST 2013


Author: sgriepentrog
Date: Tue Dec  3 10:35:26 2013
New Revision: 4395

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4395
Log:
Added options to ignore leaks and undefs

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=4395&r1=4394&r2=4395
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/configs/valgrind.supp Tue Dec  3 10:35:26 2013
@@ -59,3 +59,76 @@
 }
 
 
+{
+   sockaddr-ouraddrfor
+   Memcheck:Cond
+   fun:_ast_sockaddr_port
+   fun:ast_ouraddrfor
+   fun:ast_find_ourip
+   fun:load_module
+   fun:start_resource
+   fun:load_resource_list
+   fun:load_modules
+   fun:main
+}
+
+{
+   sockaddr-findourip
+   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
+}
+
+
+{
+   speex-decode
+   Memcheck:Cond
+   fun:speex_decode_int
+   fun:speextolin_framein
+   fun:framein
+   fun:calc_cost
+   fun:__ast_register_translator
+   fun:load_module
+   fun:start_resource
+   fun:load_resource_list
+   fun:load_modules
+   fun:main
+}
+
+{
+   speex-floor
+   Memcheck:Cond
+   fun:floor
+   fun:speex_decode_int
+   fun:speextolin_framein
+   fun:framein
+   fun:calc_cost
+   fun:__ast_register_translator
+   fun:load_module
+   fun:start_resource
+   fun:load_resource_list
+   fun:load_modules
+   fun:main
+}
+
+{
+   write-sqlite1
+   Memcheck:Param
+   write(buf)
+   obj:/lib*/libc*
+   fun:sqliteOsWrite
+   ...
+}
+{
+   write-sqlite2
+   Memcheck:Param
+   ...
+   obj:/usr/lib*/libsqlite*
+   ...
+}
+

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=4395&r1=4394&r2=4395
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/TestCase.py Tue Dec  3 10:35:26 2013
@@ -100,6 +100,8 @@
         self._pcap_callbacks = []
         self.valgrind = False
         self.valgrind_gensupp = False
+        self.valgrind_leak = "full"
+        self.valgrind_undef = "yes"
 
         """ Pull additional configuration from YAML config if possible """
         if test_config and 'reactor-timeout' in test_config:
@@ -137,6 +139,10 @@
             logger.info("Adjusting reactor timeout to %d for valgrind" % self.reactor_timeout)
             if os.getenv("VALGRINDGENSUPP") == "true":
                 self.valgrind_gensupp = True
+            if os.getenv("VALGRINDLEAK"):
+                self.valgrind_leak = os.getenv("VALGRINDLEAK");
+            if os.getenv("VALGRINDUNDEF"):
+                self.valgrind_undef = os.getenv("VALGRINDUNDEF");
             if TestSuiteUtils.which('valgrind') is None:
                 logger.error("VALGRIND IS NOT INSTALLED - running test without it")
                 self.valgrind = False
@@ -204,6 +210,8 @@
             self.ast.append(Asterisk(base=self.base, host=host))
             self.ast[c].valgrind = self.valgrind
             self.ast[c].valgrind_gensupp = self.valgrind_gensupp
+            self.ast[c].valgrind_leak = self.valgrind_leak
+            self.ast[c].valgrind_undef = self.valgrind_undef
 
             """ 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=4395&r1=4394&r2=4395
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/lib/python/asterisk/asterisk.py Tue Dec  3 10:35:26 2013
@@ -324,15 +324,24 @@
                 logger.info("Using the valgrind suppression file %s" % (self.valgrind_supp_filename))
                 self.cmd = [ "--suppressions=%s" % (self.valgrind_supp_filename) ] + self.cmd
 
+            if self.valgrind_leak.lower() == "all":
+                self.cmd = [ "--show-reachable=yes" ] + self.cmd
+                self.valgrind_leak = "full"
+
+            if self.valgrind_leak.lower() == "no":
+                self.cmd = [ "--show-possibly-lost=no" ] + self.cmd
+
+            if self.valgrind_undef.lower() == "no":
+                self.cmd = [ "--undef-value-errors=no" ] + self.cmd
+
             self.cmd = [
                 "valgrind",
                 "--log-file=%s" % (self.valgrind_log_filename),
                 "--xml=yes",
                 "--xml-file=%s" % (self.valgrind_xml_filename),
                 "--num-callers=50",
-                "--leak-check=full",
-#                "--show-possibly-list=no",
-#                "--show-reachable=yes",
+                "--error-limit=no",
+                "--leak-check=%s" % (self.valgrind_leak),
             ] + 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=4395&r1=4394&r2=4395
==============================================================================
--- asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py (original)
+++ asterisk/team/sgriepentrog/testsuite-valgrind/runtests.py Tue Dec  3 10:35:26 2013
@@ -195,6 +195,7 @@
     def __parse_valgrind_xml_doc(self, xmldoc, i):
         count_bytes_leaked = 0
         count_errors_found = 0
+        count_errors_ignored = 0
         count_error_kinds = {}
         code = {}
         supp = []
@@ -248,6 +249,10 @@
                 what = getText(error.getElementsByTagName('what'))
 
                 if kind == "Leak_DefinitelyLost":
+                    if os.environ["VALGRINDLEAK"].lower() == "no":
+                        count_errors_ignored += 1
+                        count_errors_found -= 1
+                        continue
                     leaked_bytes = error.getElementsByTagName('leakedbytes')
                     if len(leaked_bytes) == 1:
                         dom_element = leaked_bytes[0]
@@ -276,7 +281,8 @@
                     suppression = suppressions[0]
                     rawtext = getData(suppression.getElementsByTagName('rawtext'))
                     if rawtext != "":
-                        supp.append(rawtext)
+                        if not rawtext in supp:
+                            supp.append(rawtext)
 
         except Exception, e:
             msg = "Exception interpreting XML: %s" % (e)
@@ -307,6 +313,10 @@
             self.stdout += msg + "\n"
             print msg
             self.passed = False
+        if count_errors_ignored > 0:
+            msg = "Valgrind ignored %s total errors" % (count_errors_ignored)
+            self.stdout += msg + "\n"
+            print msg
         if count_errors_found > 0:
             msg = "Valgrind detected %s total errors" % (count_errors_found)
             self.stdout += msg + "\n"
@@ -606,12 +616,18 @@
     parser.add_option("-L", "--list-tags", action="store_true",
             dest="list_tags", default=False,
             help="List available tags")
-    parser.add_option("--valgrind", action="store_true",
+    parser.add_option("-V", "--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")
+    parser.add_option("--valgrind-leak", 
+            dest="valgrind_leak", default="full",
+            help="Set leak check to one of: no, summary, yes, full (default)")
+    parser.add_option("--valgrind-undef", 
+            dest="valgrind_undef", default="yes",
+            help="Set undefined check to one of: no, yes (default)")
     (options, args) = parser.parse_args(argv)
 
     ast_version = AsteriskVersion(options.version)
@@ -635,6 +651,10 @@
         os.environ["VALGRIND"] = "true"
     if options.valgrind_gensupp:
         os.environ["VALGRINDGENSUPP"] = "true"
+    if options.valgrind_leak:
+        os.environ["VALGRINDLEAK"] = options.valgrind_leak
+    if options.valgrind_undef:
+        os.environ["VALGRINDUNDEF"] = options.valgrind_undef
 
     print "Running tests for Asterisk %s ...\n" % str(ast_version)
 




More information about the asterisk-commits mailing list