Bug 469518 - Enable Reftest leak log in tinderbox (log); (Cv1) "Fix" processLeakLog() arguments; r=jwalden+bmo
authorSerge Gautherie <sgautherie.bz@free.fr>
Tue, 10 Mar 2009 15:10:25 +0100
changeset 25983 546d72c0e307c6953c195a2e4637f4136985e431
parent 25982 2d87bbd2cf097dda3fe201eaca54acf7927dd7ab
child 25984 ca0d33fe11787c59423160d24ef82c1e91a4b885
push id5832
push usersgautherie.bz@free.fr
push dateTue, 10 Mar 2009 14:11:49 +0000
treeherderautoland@546d72c0e307 [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); (Cv1) "Fix" processLeakLog() arguments; r=jwalden+bmo
build/automation.py.in
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -402,68 +402,67 @@ def environment(env = None, xrePath = DI
     env["PATH"] = env["PATH"] + ";" + ldLibraryPath
 
   return env
 
 ###############
 # RUN THE APP #
 ###############
 
-def processLeakLog(LEAK_REPORT_FILE, leakThreshold):
+def processLeakLog(leakLogFile, leakThreshold):
   "Process the leak log."
 
-  if not os.path.exists(LEAK_REPORT_FILE):
+  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+)")
 
-    leaks = open(LEAK_REPORT_FILE, "r")
+    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()
 
-    threshold = leakThreshold
-    leaks = open(LEAK_REPORT_FILE, "r")
+    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 > threshold:
+        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 threshold != 0:
-          leakLog += " (threshold set at %d bytes)" % threshold
+        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: