Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Backed out changeset e1d144423657 (bug 1280571) for making leaks hard…
Browse files Browse the repository at this point in the history
… to diagnose a=backout CLOSED TREE
  • Loading branch information
KWierso committed Sep 21, 2016
1 parent 7d16fb5 commit 6cbe32e
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 92 deletions.
2 changes: 0 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[flake8]
# See http://pep8.readthedocs.io/en/latest/intro.html#configuration
ignore = E121, E123, E126, E133, E226, E241, E242, E704, W503, E402
max-line-length = 99
filename = *.py, +.lint
32 changes: 11 additions & 21 deletions testing/mochitest/bisection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ def __init__(self, harness):
self.max_failures = 3

def setup(self, tests):
"""This method is used to initialize various variables that are required
for test bisection"""
"This method is used to initialize various variables that are required for test bisection"
status = 0
self.contents.clear()
# We need totalTests key in contents for sanity check
Expand All @@ -26,8 +25,7 @@ def setup(self, tests):
return status

def reset(self, expectedError, result):
"""This method is used to initialize self.expectedError and self.result
for each loop in runtests."""
"This method is used to initialize self.expectedError and self.result for each loop in runtests."
self.expectedError = expectedError
self.result = result

Expand All @@ -42,27 +40,23 @@ def get_tests_for_bisection(self, options, tests):
return bisectlist

def pre_test(self, options, tests, status):
"""This method is used to call other methods for setting up variables and
getting the list of tests for bisection."""
"This method is used to call other methods for setting up variables and getting the list of tests for bisection."
if options.bisectChunk == "default":
return tests
# The second condition in 'if' is required to verify that the failing
# test is the last one.
elif ('loop' not in self.contents or not self.contents['tests'][-1].endswith(
options.bisectChunk)):
elif 'loop' not in self.contents or not self.contents['tests'][-1].endswith(options.bisectChunk):
tests = self.get_tests_for_bisection(options, tests)
status = self.setup(tests)

return self.next_chunk_binary(options, status)

def post_test(self, options, expectedError, result):
"""This method is used to call other methods to summarize results and check whether a
sanity check is done or not."""
"This method is used to call other methods to summarize results and check whether a sanity check is done or not."
self.reset(expectedError, result)
status = self.summarize_chunk(options)
# Check whether sanity check has to be done. Also it is necessary to check whether
# options.bisectChunk is present in self.expectedError as we do not want to run
# if it is "default".
# Check whether sanity check has to be done. Also it is necessary to check whether options.bisectChunk is present
# in self.expectedError as we do not want to run if it is "default".
if status == -1 and options.bisectChunk in self.expectedError:
# In case we have a debug build, we don't want to run a sanity
# check, will take too much time.
Expand Down Expand Up @@ -219,8 +213,7 @@ def summarize_chunk(self, options):
# is the failing test itself therefore the bleedthrough
# test is the first test
self.summary.append(
"TEST-UNEXPECTED-FAIL | %s | Bleedthrough detected, this test is the "
"root cause for many of the above failures" %
"TEST-UNEXPECTED-FAIL | %s | Bleedthrough detected, this test is the root cause for many of the above failures" %
self.contents['testsToRun'][0])
status = -1
else:
Expand All @@ -243,8 +236,7 @@ def check_for_intermittent(self, options):
return 0
else:
if self.failcount > 0:
# -1 is being returned as the test is intermittent, so no need to bisect
# further.
# -1 is being returned as the test is intermittent, so no need to bisect further.
return -1
# If the test does not fail even once, then proceed to next chunk for bisection.
# loop is set to 2 to proceed on bisection.
Expand All @@ -262,14 +254,12 @@ def check_for_intermittent(self, options):
# limit set, it is a perma-fail.
if self.failcount < self.max_failures:
if self.repeat == 0:
# -1 is being returned as the test is intermittent, so no need to bisect
# further.
# -1 is being returned as the test is intermittent, so no need to bisect further.
return -1
return 0
else:
self.summary.append(
"TEST-UNEXPECTED-FAIL | %s | Bleedthrough detected, this test is the "
"root cause for many of the above failures" %
"TEST-UNEXPECTED-FAIL | %s | Bleedthrough detected, this test is the root cause for many of the above failures" %
self.contents['testsToRun'][0])
return -1

Expand Down
24 changes: 9 additions & 15 deletions testing/mochitest/leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,17 @@ def process(self):
for test in self._parseLeakingTests():
for url, count in self._zipLeakedWindows(test["leakedWindows"]):
self.logger.warning(
"TEST-UNEXPECTED-FAIL | %s | leaked %d window(s) until shutdown "
"[url = %s]") % (test["fileName"], count, url)
"TEST-UNEXPECTED-FAIL | %s | leaked %d window(s) until shutdown [url = %s]" % (test["fileName"], count, url))

if test["leakedWindowsString"]:
self.logger.info("TEST-INFO | %s | windows(s) leaked: %s" %
(test["fileName"], test["leakedWindowsString"]))

if test["leakedDocShells"]:
self.logger.warning("TEST-UNEXPECTED-FAIL | %s | leaked %d docShell(s) until "
"shutdown" %
(test["fileName"], len(test["leakedDocShells"])))
self.logger.info("TEST-INFO | %s | docShell(s) leaked: %s" %
(test["fileName"], ', '.join(["[pid = %s] [id = %s]" %
x for x in test["leakedDocShells"]]
)))
self.logger.warning("TEST-UNEXPECTED-FAIL | %s | leaked %d docShell(s) until shutdown" % (
test["fileName"], len(test["leakedDocShells"])))
self.logger.info("TEST-INFO | %s | docShell(s) leaked: %s" % (test["fileName"],
', '.join(["[pid = %s] [id = %s]" % x for x in test["leakedDocShells"]])))

def _logWindow(self, line):
created = line[:2] == "++"
Expand Down Expand Up @@ -233,14 +229,12 @@ def log(self, line):

def process(self):
if self.fatalError:
self.logger.warning("TEST-UNEXPECTED-FAIL | LeakSanitizer | LeakSanitizer "
"has encountered a fatal error.")
self.logger.warning(
"TEST-UNEXPECTED-FAIL | LeakSanitizer | LeakSanitizer has encountered a fatal error.")

if self.foundFrames:
self.logger.info("TEST-INFO | LeakSanitizer | To show the "
"addresses of leaked objects add report_objects=1 to LSAN_OPTIONS")
self.logger.info("TEST-INFO | LeakSanitizer | This can be done "
"in testing/mozbase/mozrunner/mozrunner/utils.py")
self.logger.info("TEST-INFO | LeakSanitizer | To show the addresses of leaked objects add report_objects=1 to LSAN_OPTIONS")
self.logger.info("TEST-INFO | LeakSanitizer | This can be done in testing/mozbase/mozrunner/mozrunner/utils.py")

for f in self.foundFrames:
self.logger.warning(
Expand Down
4 changes: 2 additions & 2 deletions testing/mochitest/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from itertools import chain
import logging
import os
import shutil
import sys
import warnings

Expand Down Expand Up @@ -349,8 +350,7 @@ def verify_host_bin():
# validate MOZ_HOST_BIN environment variables for Android tests
MOZ_HOST_BIN = os.environ.get('MOZ_HOST_BIN')
if not MOZ_HOST_BIN:
print('environment variable MOZ_HOST_BIN must be set to a directory containing host '
'xpcshell')
print('environment variable MOZ_HOST_BIN must be set to a directory containing host xpcshell')
return 1
elif not os.path.isdir(MOZ_HOST_BIN):
print('$MOZ_HOST_BIN does not specify a directory')
Expand Down
12 changes: 6 additions & 6 deletions testing/mochitest/runrobocop.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ def setupRobotiumConfig(self, browserEnv):
for key, value in browserEnv.items():
try:
value.index(',')
self.log.error("setupRobotiumConfig: browserEnv - Found a ',' "
"in our value, unable to process value. key=%s,value=%s" %
(key, value))
self.log.error(
"setupRobotiumConfig: browserEnv - Found a ',' in our value, unable to process value. key=%s,value=%s" %
(key, value))
self.log.error("browserEnv=%s" % browserEnv)
except ValueError:
envstr += "%s%s=%s" % (delim, key, value)
Expand Down Expand Up @@ -445,9 +445,9 @@ def runSingleTest(self, test):
# This does not launch a test at all. It launches an activity
# that starts Fennec and then waits indefinitely, since cat
# never returns.
browserArgs = ["start", "-n",
"org.mozilla.roboexample.test/org.mozilla."
"gecko.LaunchFennecWithConfigurationActivity", "&&", "cat"]
browserArgs = ["start",
"-n", "org.mozilla.roboexample.test/org.mozilla.gecko.LaunchFennecWithConfigurationActivity",
"&&", "cat"]
self.dm.default_timeout = sys.maxint # Forever.
self.log.info("")
self.log.info("Serving mochi.test Robocop root at http://%s:%s/tests/robocop/" %
Expand Down
Loading

0 comments on commit 6cbe32e

Please sign in to comment.