Bug 469518 - Enable Reftest leak log in tinderbox (log); (Dv1) Early return in processLeakLog(); r=jwalden+bmo
authorSerge Gautherie <sgautherie.bz@free.fr>
Tue, 17 Mar 2009 15:22:57 +0100
changeset 26250 3f15160cf850b8f016e195cd5363f17bf30fb50c
parent 26249 1752f796d0aa497715818280698323c7545786c5
child 26251 95497d18ce825f6d1b2e896a5793ad5ac0d3847f
push id5975
push usersgautherie.bz@free.fr
push dateTue, 17 Mar 2009 14:23:33 +0000
treeherdermozilla-central@01987cfc569b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs469518
milestone1.9.2a1pre
Bug 469518 - Enable Reftest leak log in tinderbox (log); (Dv1) Early return in processLeakLog(); r=jwalden+bmo
build/automation.py.in
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -429,83 +429,84 @@ def checkForCrashes(profileDir, symbolsP
 # RUN THE APP #
 ###############
 
 def processLeakLog(leakLogFile, leakThreshold):
   "Process the leak log."
 
   if not os.path.exists(leakLogFile):
     log.info("WARNING refcount logging is off, so leaks can't be detected!")
-  else:
-    #                  Per-Inst  Leaked      Total  Rem ...
-    #   0 TOTAL              17     192  419115886    2 ...
-    # 833 nsTimerImpl        60     120      24726    2 ...
-    lineRe = re.compile(r"^\s*\d+\s+(?P<name>\S+)\s+"
-                        r"(?P<size>-?\d+)\s+(?P<bytesLeaked>-?\d+)\s+"
-                        r"\d+\s+(?P<numLeaked>-?\d+)")
+    return
+
+  #                  Per-Inst  Leaked      Total  Rem ...
+  #   0 TOTAL              17     192  419115886    2 ...
+  # 833 nsTimerImpl        60     120      24726    2 ...
+  lineRe = re.compile(r"^\s*\d+\s+(?P<name>\S+)\s+"
+                      r"(?P<size>-?\d+)\s+(?P<bytesLeaked>-?\d+)\s+"
+                      r"\d+\s+(?P<numLeaked>-?\d+)")
 
-    leaks = open(leakLogFile, "r")
-    for line in leaks:
-      matches = lineRe.match(line)
-      if (matches and
-          int(matches.group("numLeaked")) == 0 and
-          matches.group("name") != "TOTAL"):
-        continue
-      log.info(line.rstrip())
-    leaks.close()
+  leaks = open(leakLogFile, "r")
+  for line in leaks:
+    matches = lineRe.match(line)
+    if (matches and
+        int(matches.group("numLeaked")) == 0 and
+        matches.group("name") != "TOTAL"):
+      continue
+    log.info(line.rstrip())
+  leaks.close()
 
-    leaks = open(leakLogFile, "r")
-    seenTotal = False
-    prefix = "TEST-PASS"
-    for line in leaks:
-      matches = lineRe.match(line)
-      if not matches:
-        continue
-      name = matches.group("name")
-      size = int(matches.group("size"))
-      bytesLeaked = int(matches.group("bytesLeaked"))
-      numLeaked = int(matches.group("numLeaked"))
-      if size < 0 or bytesLeaked < 0 or numLeaked < 0:
-        log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | negative leaks caught!")
-      if "TOTAL" == name:
-        seenTotal = True
-        # Check for leaks.
-        if bytesLeaked < 0 or bytesLeaked > leakThreshold:
-          prefix = "TEST-UNEXPECTED-FAIL"
-          leakLog = "TEST-UNEXPECTED-FAIL | runtests-leaks | leaked" \
-                    " %d bytes during test execution" % bytesLeaked
-        elif bytesLeaked > 0:
-          leakLog = "TEST-PASS | runtests-leaks | WARNING leaked" \
-                    " %d bytes during test execution" % bytesLeaked
+  leaks = open(leakLogFile, "r")
+  seenTotal = False
+  prefix = "TEST-PASS"
+  for line in leaks:
+    matches = lineRe.match(line)
+    if not matches:
+      continue
+    name = matches.group("name")
+    size = int(matches.group("size"))
+    bytesLeaked = int(matches.group("bytesLeaked"))
+    numLeaked = int(matches.group("numLeaked"))
+    if size < 0 or bytesLeaked < 0 or numLeaked < 0:
+      log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | negative leaks caught!")
+    if "TOTAL" == name:
+      seenTotal = True
+      # Check for leaks.
+      if bytesLeaked < 0 or bytesLeaked > leakThreshold:
+        prefix = "TEST-UNEXPECTED-FAIL"
+        leakLog = "TEST-UNEXPECTED-FAIL | runtests-leaks | leaked" \
+                  " %d bytes during test execution" % bytesLeaked
+      elif bytesLeaked > 0:
+        leakLog = "TEST-PASS | runtests-leaks | WARNING leaked" \
+                  " %d bytes during test execution" % bytesLeaked
+      else:
+        leakLog = "TEST-PASS | runtests-leaks | no leaks detected!"
+      # Remind the threshold if it is not 0, which is the default/goal.
+      if leakThreshold != 0:
+        leakLog += " (threshold set at %d bytes)" % leakThreshold
+      # Log the information.
+      log.info(leakLog)
+    else:
+      if numLeaked != 0:
+        if abs(numLeaked) > 1:
+          instance = "instances"
+          rest = " each (%s bytes total)" % matches.group("bytesLeaked")
         else:
-          leakLog = "TEST-PASS | runtests-leaks | no leaks detected!"
-        # Remind the threshold if it is not 0, which is the default/goal.
-        if leakThreshold != 0:
-          leakLog += " (threshold set at %d bytes)" % leakThreshold
-        # Log the information.
-        log.info(leakLog)
-      else:
-        if numLeaked != 0:
-          if abs(numLeaked) > 1:
-            instance = "instances"
-            rest = " each (%s bytes total)" % matches.group("bytesLeaked")
-          else:
-            instance = "instance"
-            rest = ""
-          log.info("%(prefix)s | runtests-leaks | leaked %(numLeaked)d %(instance)s of %(name)s "
-                   "with size %(size)s bytes%(rest)s" %
-                   { "prefix": prefix,
-                     "numLeaked": numLeaked,
-                     "instance": instance,
-                     "name": name,
-                     "size": matches.group("size"),
-                     "rest": rest })
-    if not seenTotal:
-      log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | missing output line for total leaks!")
-    leaks.close()
+          instance = "instance"
+          rest = ""
+        log.info("%(prefix)s | runtests-leaks | leaked %(numLeaked)d %(instance)s of %(name)s "
+                 "with size %(size)s bytes%(rest)s" %
+                 { "prefix": prefix,
+                   "numLeaked": numLeaked,
+                   "instance": instance,
+                   "name": name,
+                   "size": matches.group("size"),
+                   "rest": rest })
+  if not seenTotal:
+    log.info("TEST-UNEXPECTED-FAIL | runtests-leaks | missing output line for total leaks!")
+  leaks.close()
 
 def runApp(testURL, env, app, profileDir, extraArgs,
            runSSLTunnel = False, utilityPath = DIST_BIN,
            xrePath = DIST_BIN, certPath = CERTS_SRC_DIR,
            debuggerInfo = None, symbolsPath = SYMBOLS_PATH):
   "Run the app, log the duration it took to execute, return the status code."
 
   if IS_TEST_BUILD and runSSLTunnel: