From d4a650a82bf595843dc4ed507a19488f85681e96 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 26 Sep 2014 16:02:12 -0400 Subject: [PATCH] Backed out 4 changesets (bug 1068276, bug 1067664) for Android leaktest complaints. Backed out changeset 846faaa68219 (bug 1068276) Backed out changeset 35e71ffcf8e1 (bug 1068276) Backed out changeset 605f59a806fd (bug 1067664) Backed out changeset 2d5b7ea96b70 (bug 1067664) --HG-- extra : rebase_source : 7a90c78ba35f31acce7609d5d8375a593cb9825d --- build/automationutils.py | 49 +++++++++----------------- layout/tools/reftest/runreftest.py | 16 ++++----- testing/mochitest/mochitest_options.py | 27 ++++---------- testing/mochitest/runtests.py | 2 +- testing/mochitest/runtestsb2g.py | 2 +- 5 files changed, 30 insertions(+), 66 deletions(-) diff --git a/build/automationutils.py b/build/automationutils.py index 46a909db5e4..df8be4946ed 100644 --- a/build/automationutils.py +++ b/build/automationutils.py @@ -196,7 +196,7 @@ def dumpLeakLog(leakLogFile, filter = False): # Simply copy the log. log.info(leakReport.rstrip("\n")) -def processSingleLeakFile(leakLogFileName, processType, leakThreshold, ignoreMissingLeaks): +def processSingleLeakFile(leakLogFileName, processType, leakThreshold): """Process a single leak log. """ @@ -273,14 +273,11 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold, ignoreMis if crashedOnPurpose: log.info("TEST-INFO | leakcheck | %s deliberate crash and thus no leak log" % processString) - elif ignoreMissingLeaks: - log.info("TEST-INFO | leakcheck | %s ignoring missing output line for total leaks" - % processString) else: - log.info("TEST-UNEXPECTED-FAIL | leakcheck | %s missing output line for total leaks!" + # TODO: This should be a TEST-UNEXPECTED-FAIL, but was changed to a warning + # due to too many intermittent failures (see bug 831223). + log.info("WARNING | leakcheck | %s missing output line for total leaks!" % processString) - log.info("TEST-INFO | leakcheck | missing output line from log file %s" - % leakLogFileName) return if totalBytesLeaked == 0: @@ -289,9 +286,14 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold, ignoreMis # totalBytesLeaked was seen and is non-zero. if totalBytesLeaked > leakThreshold: - logAsWarning = True - # Fail the run if we're over the threshold (which defaults to 0) - prefix = "TEST-UNEXPECTED-FAIL" + if processType == "tab": + # For now, ignore tab process leaks. See bug 1051230. + log.info("WARNING | leakcheck | ignoring leaks in tab process") + prefix = "WARNING" + else: + logAsWarning = True + # Fail the run if we're over the threshold (which defaults to 0) + prefix = "TEST-UNEXPECTED-FAIL" else: prefix = "WARNING" # Create a comma delimited string of the first N leaked objects found, @@ -309,7 +311,7 @@ def processSingleLeakFile(leakLogFileName, processType, leakThreshold, ignoreMis log.info("%s | leakcheck | %s %d bytes leaked (%s)" % (prefix, processString, totalBytesLeaked, leakedObjectSummary)) -def processLeakLog(leakLogFile, leakThresholds, ignoreMissingLeaks): +def processLeakLog(leakLogFile, leakThreshold = 0): """Process the leak log, including separate leak logs created by child processes. @@ -324,28 +326,14 @@ def processLeakLog(leakLogFile, leakThresholds, ignoreMissingLeaks): optional. All other file names are treated as being for default processes. - - leakThresholds should be a dict mapping process types to leak thresholds, - in bytes. If a process type is not present in the dict the threshold - will be 0. """ if not os.path.exists(leakLogFile): log.info("WARNING | leakcheck | refcount logging is off, so leaks can't be detected!") return - # This list is based on kGeckoProcessTypeString. ipdlunittest processes likely - # are not going to produce leak logs we will ever see. - knownProcessTypes = ["default", "plugin", "tab", "geckomediaplugin"] - - for processType in knownProcessTypes: - log.info("TEST-INFO | leakcheck | %s process: leak threshold set at %d bytes" - % (processType, leakThresholds.get(processType, 0))) - - for processType in leakThresholds: - if not processType in knownProcessTypes: - log.info("TEST-UNEXPECTED-FAIL | leakcheck | Unknown process type %s in leakThresholds" - % processType) + if leakThreshold != 0: + log.info("TEST-INFO | leakcheck | threshold set at %d bytes" % leakThreshold) (leakLogFileDir, leakFileBase) = os.path.split(leakLogFile) if leakFileBase[-4:] == ".log": @@ -362,12 +350,7 @@ def processLeakLog(leakLogFile, leakThresholds, ignoreMissingLeaks): processType = m.group(1) else: processType = "default" - if not processType in knownProcessTypes: - log.info("TEST-UNEXPECTED-FAIL | leakcheck | Leak log with unknown process type %s" - % processType) - leakThreshold = leakThresholds.get(processType, 0) - processSingleLeakFile(thisFile, processType, leakThreshold, - processType in ignoreMissingLeaks) + processSingleLeakFile(thisFile, processType, leakThreshold) def replaceBackSlashes(input): return input.replace('\\', '/') diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py index a9f22ffda41..875348570fc 100644 --- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -344,7 +344,7 @@ class RefTest(object): # give the JS harness 30 seconds to deal # with its own timeouts timeout=options.timeout + 30.0) - processLeakLog(self.leakLogFile, options.leakThresholds, options.ignoreMissingLeaks) + processLeakLog(self.leakLogFile, options.leakThreshold) self.automation.log.info("\nREFTEST INFO | runreftest.py | Running tests: end.") finally: self.cleanup(profileDir) @@ -394,12 +394,12 @@ class ReftestOptions(OptionParser): default = 5 * 60, # 5 minutes per bug 479518 help = "reftest will timeout in specified number of seconds. [default %default s].") self.add_option("--leak-threshold", - action = "store", type = "int", dest = "defaultLeakThreshold", + action = "store", type = "int", dest = "leakThreshold", default = 0, - help = "fail if the number of bytes leaked in default " - "processes through refcounted objects (or bytes " - "in classes with MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) " - "is greater than the given number") + help = "fail if the number of bytes leaked through " + "refcounted objects (or bytes in classes with " + "MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) is greater " + "than the given number") self.add_option("--utility-path", action = "store", type = "string", dest = "utilityPath", default = self.automation.DIST_BIN, @@ -511,10 +511,6 @@ class ReftestOptions(OptionParser): if options.debugger is not None: self.error("cannot specify a debugger with parallel tests") - options.leakThresholds = {"default": options.defaultLeakThreshold} - - options.ignoreMissingLeaks = [] - return options def main(): diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py index 507c22b83ef..91d79d470d9 100644 --- a/testing/mochitest/mochitest_options.py +++ b/testing/mochitest/mochitest_options.py @@ -223,12 +223,12 @@ class MochitestOptions(optparse.OptionParser): [["--leak-threshold"], { "action": "store", "type": "int", - "dest": "defaultLeakThreshold", + "dest": "leakThreshold", "metavar": "THRESHOLD", - "help": "fail if the number of bytes leaked in default " - "processes through refcounted objects (or bytes " - "in classes with MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) " - "is greater than the given number", + "help": "fail if the number of bytes leaked through " + "refcounted objects (or bytes in classes with " + "MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) is greater " + "than the given number", "default": 0, }], [["--fatal-assertions"], @@ -608,15 +608,6 @@ class MochitestOptions(optparse.OptionParser): if not os.path.isfile(f): self.error('Missing binary %s required for --use-test-media-devices') - options.leakThresholds = { - "default": options.defaultLeakThreshold, - "tab": 10000, # See dependencies of bug 1051230. - } - - # Bug 1051230 - Leak logging does not yet work for tab processes on desktop. - # Bug 1065098 - The geckomediaplugin process fails to produce a leak log for some reason. - options.ignoreMissingLeaks = ["tab", "geckomediaplugin"] - return options @@ -774,7 +765,7 @@ class B2GOptions(MochitestOptions): defaults["testPath"] = "" defaults["extensionsToExclude"] = ["specialpowers"] # See dependencies of bug 1038943. - defaults["defaultLeakThreshold"] = 5180 + defaults["leakThreshold"] = 5180 self.set_defaults(**defaults) def verifyRemoteOptions(self, options): @@ -821,12 +812,6 @@ class B2GOptions(MochitestOptions): options.sslPort = tempSSL options.httpPort = tempPort - # Bug 1071866 - B2G Mochitests do not always produce a leak log. - options.ignoreMissingLeaks.append("default") - - # Bug 1070068 - Leak logging does not work for tab processes on B2G. - assert "tab" in options.ignoreMissingLeaks, "Ignore failures for tab processes on B2G" - return options def elf_arm(self, filename): diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 668af88fd19..b370bc8c33c 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -1843,7 +1843,7 @@ class Mochitest(MochitestUtilsMixin): self.stopVMwareRecording(); self.stopServers() - processLeakLog(self.leak_report_file, options.leakThresholds, options.ignoreMissingLeaks) + processLeakLog(self.leak_report_file, options.leakThreshold) if self.nsprLogs: with zipfile.ZipFile("%s/nsprlog.zip" % browserEnv["MOZ_UPLOAD_DIR"], "w", zipfile.ZIP_DEFLATED) as logzip: diff --git a/testing/mochitest/runtestsb2g.py b/testing/mochitest/runtestsb2g.py index ed0a2d99cb4..b9010e6d7b1 100644 --- a/testing/mochitest/runtestsb2g.py +++ b/testing/mochitest/runtestsb2g.py @@ -202,7 +202,7 @@ class B2GMochitest(MochitestUtilsMixin): self.app_ctx.dm.getFile(self.leak_report_file, local_leak_file.name) self.app_ctx.dm.removeFile(self.leak_report_file) - processLeakLog(local_leak_file.name, options.leakThresholds, options.ignoreMissingLeaks) + processLeakLog(local_leak_file.name, options.leakThreshold) except KeyboardInterrupt: self.log.info("runtests.py | Received keyboard interrupt.\n"); status = -1