Bug 850681 - Part 2: Wait until the full leak log has been processed before outputting the leak total; r=ted
authorEd Morley <emorley@mozilla.com>
Mon, 18 Mar 2013 17:18:04 +0000
changeset 136464 c314aefc1244a6c370c163e0e29f5613eaebb77b
parent 136463 102365bfe4d3344eef6d7ec451c1c8890f2a74fd
child 136465 0c83c9036f9e70644541bafc7a34ee4074199b14
push id336
push userakeybl@mozilla.com
push dateMon, 17 Jun 2013 22:53:19 +0000
treeherdermozilla-release@574a39cdf657 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs850681
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 850681 - Part 2: Wait until the full leak log has been processed before outputting the leak total; r=ted Will allow the addition of an overview of the leaked objects, in part 4.
build/automationutils.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -316,80 +316,82 @@ def processSingleLeakFile(leakLogFileNam
     if (matches and
         int(matches.group("numLeaked")) == 0 and
         matches.group("name") != "TOTAL"):
       continue
     log.info(line.rstrip())
   leaks.close()
 
   leaks = open(leakLogFileName, "r")
-  seenTotal = False
   crashedOnPurpose = False
-  prefix = "TEST-PASS"
+  totalBytesLeaked = None
   numObjects = 0
   for line in leaks:
     if line.find("purposefully crash") > -1:
       crashedOnPurpose = True
     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 %s| leakcheck | negative leaks caught!" %
                processString)
       if name == "TOTAL":
-        seenTotal = True
+        totalBytesLeaked = bytesLeaked
     elif name == "TOTAL":
-      seenTotal = True
-      # Check for leaks.
-      if bytesLeaked < 0 or bytesLeaked > leakThreshold:
-        prefix = "TEST-UNEXPECTED-FAIL"
-        leakLog = "TEST-UNEXPECTED-FAIL %s| leakcheck | leaked" \
-                  " %d bytes during test execution" % (processString, bytesLeaked)
-      elif bytesLeaked > 0:
-        leakLog = "TEST-PASS %s| leakcheck | WARNING leaked" \
-                  " %d bytes during test execution" % (processString, bytesLeaked)
-      else:
-        leakLog = "TEST-PASS %s| leakcheck | no leaks detected!" \
-                  % processString
-      # 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)
+      totalBytesLeaked = bytesLeaked
     else:
       if numLeaked != 0:
         if numLeaked > 1:
           instance = "instances"
           rest = " each (%s bytes total)" % matches.group("bytesLeaked")
         else:
           instance = "instance"
           rest = ""
         numObjects += 1
         if numObjects > 5:
           # don't spam brief tinderbox logs with tons of leak output
           prefix = "TEST-INFO"
+        else:
+          prefix = "TEST-UNEXPECTED-FAIL"
         log.info("%(prefix)s %(process)s| leakcheck | leaked %(numLeaked)d %(instance)s of %(name)s "
                  "with size %(size)s bytes%(rest)s" %
                  { "prefix": prefix,
                    "process": processString,
                    "numLeaked": numLeaked,
                    "instance": instance,
                    "name": name,
                    "size": matches.group("size"),
                    "rest": rest })
-  if not seenTotal:
+  if totalBytesLeaked is None:
+    # We didn't see a line with name 'TOTAL'
     if crashedOnPurpose:
       log.info("INFO | leakcheck | process %s was " \
                "deliberately crashed and thus has no leak log" % PID)
     else:
       log.info("WARNING | leakcheck | missing output line for total leaks!")
+  else:
+    # Check for leaks.
+    if totalBytesLeaked < 0 or totalBytesLeaked > leakThreshold:
+      leakLog = "TEST-UNEXPECTED-FAIL %s| leakcheck | leaked" \
+                " %d bytes during test execution" % (processString, totalBytesLeaked)
+    elif totalBytesLeaked > 0:
+      leakLog = "TEST-PASS %s| leakcheck | WARNING leaked" \
+                " %d bytes during test execution" % (processString, totalBytesLeaked)
+    else:
+      leakLog = "TEST-PASS %s| leakcheck | no leaks detected!" \
+                % processString
+    # 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)
   leaks.close()
 
 
 def processLeakLog(leakLogFile, leakThreshold = 0):
   """Process the leak log, including separate leak logs created
   by child processes.
 
   Use this function if you want an additional PASS/FAIL summary.