diff --git a/testing/mochitest/runtests.py.in b/testing/mochitest/runtests.py.in index 542c697e7ff..711febbb457 100644 --- a/testing/mochitest/runtests.py.in +++ b/testing/mochitest/runtests.py.in @@ -365,19 +365,25 @@ Are you executing $objdir/_tests/testing/mochitest/runtests.py?""" if not os.path.exists(LEAK_REPORT_FILE): log.info("WARNING refcount logging is off, so leaks can't be detected!") else: - leaks = open(LEAK_REPORT_FILE, "r") - for line in leaks: - log.info(line.rstrip()) - leaks.close() - - threshold = options.leakThreshold - leaks = open(LEAK_REPORT_FILE, "r") # 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\S+)\s+" r"(?P-?\d+)\s+(?P-?\d+)\s+" r"\d+\s+(?P-?\d+)") + + leaks = open(LEAK_REPORT_FILE, "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 = options.leakThreshold + leaks = open(LEAK_REPORT_FILE, "r") seenTotal = False prefix = "TEST-PASS" for line in leaks: