[Asterisk-code-review] Generate logs/refleaks-summary.txt when REF DEBUG is enabled. (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Mon Dec 7 10:54:39 CST 2015


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Generate logs/refleaks-summary.txt when REF_DEBUG is enabled.
......................................................................


Generate logs/refleaks-summary.txt when REF_DEBUG is enabled.

ASTERISK-25474

Change-Id: I0e56d7a46cc6a076cafde3bebe2b7f2a0d1867f3
---
M runtests.py
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve



diff --git a/runtests.py b/runtests.py
index 638652a..3d816cd 100755
--- a/runtests.py
+++ b/runtests.py
@@ -55,6 +55,8 @@
 # If True, abandon the current running TestSuite. Used by SIGUSR1/SIGTERM.
 abandon_test_suite = False
 
+# Set to True if any refs logs are processed
+ref_debug_is_enabled = False
 
 class TestRun:
     def __init__(self, test_name, ast_version, options, global_config=None, timeout=-1):
@@ -335,6 +337,9 @@
             ast_dir = "%s/ast%d/var/log/asterisk" % (run_dir, i)
             refs_in = os.path.join(ast_dir, "refs")
             if os.path.exists(refs_in):
+                global ref_debug_is_enabled
+                ref_debug_is_enabled = True
+
                 refs_txt = os.path.join(ast_dir, "refs.txt")
                 dest_file = open(refs_txt, "w")
                 refcounter = [
@@ -650,6 +655,16 @@
                 self.__strip_illegal_xml_chars(t.failure_message)))
             tc.appendChild(failure)
 
+    def generate_refleaks_summary(self):
+        dest_file = open("./logs/refleaks-summary.txt", "w")
+        try:
+            subprocess.call("./contrib/scripts/refleaks-summary",
+                                  stdout=dest_file,
+                                  stderr=subprocess.STDOUT)
+        finally:
+            dest_file.close()
+
+
 
 def load_yaml_config(path):
     """Load contents of a YAML config file to a dictionary"""
@@ -822,6 +837,9 @@
 
         iteration += 1
 
+    if ref_debug_is_enabled:
+        test_suite.generate_refleaks_summary()
+
     try:
         with open(TEST_RESULTS, "w") as f:
             doc.writexml(f, addindent="  ", newl="\n", encoding="utf-8")

-- 
To view, visit https://gerrit.asterisk.org/1773
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0e56d7a46cc6a076cafde3bebe2b7f2a0d1867f3
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list