mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 957768 - Backout no longer needed --hide-subtests mochitest option (bug 937181 implemented the same thing but better), r=jmaher
This commit is contained in:
parent
6b8e88d28f
commit
c2b2c17ee5
@ -814,7 +814,7 @@ class Automation(object):
|
||||
xrePath = None, certPath = None,
|
||||
debuggerInfo = None, symbolsPath = None,
|
||||
timeout = -1, maxTime = None, onLaunch = None,
|
||||
webapprtChrome = False, hide_subtests=None, screenshotOnFail=False):
|
||||
webapprtChrome = False, screenshotOnFail=False):
|
||||
"""
|
||||
Run the app, log the duration it took to execute, return the status code.
|
||||
Kills the app if it runs for longer than |maxTime| seconds, or outputs nothing for |timeout| seconds.
|
||||
|
@ -476,10 +476,6 @@ def MochitestCommand(func):
|
||||
help='If running tests by chunks, the number of the chunk to run.')
|
||||
func = this_chunk(func)
|
||||
|
||||
hide_subtests = CommandArgument('--hide-subtests', action='store_true',
|
||||
help='If specified, will only log subtest results on failure or timeout.')
|
||||
func = hide_subtests(func)
|
||||
|
||||
debug_on_failure = CommandArgument('--debug-on-failure', action='store_true',
|
||||
help='Breaks execution and enters the JS debugger on a test failure. ' \
|
||||
'Should be used together with --jsdebugger.')
|
||||
@ -586,10 +582,6 @@ def B2GCommand(func):
|
||||
help='If running tests by chunks, the number of the chunk to run.')
|
||||
func = this_chunk(func)
|
||||
|
||||
hide_subtests = CommandArgument('--hide-subtests', action='store_true',
|
||||
help='If specified, will only log subtest results on failure or timeout.')
|
||||
func = hide_subtests(func)
|
||||
|
||||
path = CommandArgument('test_paths', default=None, nargs='*',
|
||||
metavar='TEST',
|
||||
help='Test to run. Can be specified as a single file, a ' \
|
||||
|
@ -69,12 +69,6 @@ class MochitestOptions(optparse.OptionParser):
|
||||
"help": "file to which logging occurs",
|
||||
"default": "",
|
||||
}],
|
||||
[["--hide-subtests"],
|
||||
{ "action": "store_true",
|
||||
"dest": "hide_subtests",
|
||||
"help": "only show subtest log output if there was a failure",
|
||||
"default": False,
|
||||
}],
|
||||
[["--autorun"],
|
||||
{ "action": "store_true",
|
||||
"dest": "autorun",
|
||||
|
@ -30,7 +30,7 @@ import traceback
|
||||
import urllib2
|
||||
import zipfile
|
||||
|
||||
from automationutils import environment, getDebuggerInfo, isURL, KeyValueParseError, parseKeyValue, processLeakLog, systemMemory, dumpScreen, ShutdownLeaks, printstatus
|
||||
from automationutils import environment, getDebuggerInfo, isURL, KeyValueParseError, parseKeyValue, processLeakLog, dumpScreen, ShutdownLeaks, printstatus
|
||||
from datetime import datetime
|
||||
from manifestparser import TestManifest
|
||||
from mochitest_options import MochitestOptions
|
||||
@ -1176,7 +1176,6 @@ class Mochitest(MochitestUtilsMixin):
|
||||
timeout=-1,
|
||||
onLaunch=None,
|
||||
webapprtChrome=False,
|
||||
hide_subtests=False,
|
||||
screenshotOnFail=False):
|
||||
"""
|
||||
Run the app, log the duration it took to execute, return the status code.
|
||||
@ -1236,12 +1235,10 @@ class Mochitest(MochitestUtilsMixin):
|
||||
symbolsPath=symbolsPath,
|
||||
dump_screen_on_timeout=not debuggerInfo,
|
||||
dump_screen_on_fail=screenshotOnFail,
|
||||
hide_subtests=hide_subtests,
|
||||
shutdownLeaks=shutdownLeaks,
|
||||
)
|
||||
|
||||
def timeoutHandler():
|
||||
outputHandler.log_output_buffer()
|
||||
browserProcessId = outputHandler.browserProcessId
|
||||
self.handleTimeout(timeout, proc, utilityPath, debuggerInfo, browserProcessId)
|
||||
kp_kwargs = {'kill_on_timeout': False,
|
||||
@ -1411,7 +1408,6 @@ class Mochitest(MochitestUtilsMixin):
|
||||
timeout=timeout,
|
||||
onLaunch=onLaunch,
|
||||
webapprtChrome=options.webapprtChrome,
|
||||
hide_subtests=options.hide_subtests,
|
||||
screenshotOnFail=options.screenshotOnFail
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
@ -1453,20 +1449,16 @@ class Mochitest(MochitestUtilsMixin):
|
||||
|
||||
class OutputHandler(object):
|
||||
"""line output handler for mozrunner"""
|
||||
def __init__(self, harness, utilityPath, symbolsPath=None, dump_screen_on_timeout=True, dump_screen_on_fail=False,
|
||||
hide_subtests=False, shutdownLeaks=None):
|
||||
def __init__(self, harness, utilityPath, symbolsPath=None, dump_screen_on_timeout=True, dump_screen_on_fail=False, shutdownLeaks=None):
|
||||
"""
|
||||
harness -- harness instance
|
||||
dump_screen_on_timeout -- whether to dump the screen on timeout
|
||||
"""
|
||||
self.harness = harness
|
||||
self.output_buffer = []
|
||||
self.running_test = False
|
||||
self.utilityPath = utilityPath
|
||||
self.symbolsPath = symbolsPath
|
||||
self.dump_screen_on_timeout = dump_screen_on_timeout
|
||||
self.dump_screen_on_fail = dump_screen_on_fail
|
||||
self.hide_subtests = hide_subtests
|
||||
self.shutdownLeaks = shutdownLeaks
|
||||
|
||||
# perl binary to use
|
||||
@ -1490,13 +1482,12 @@ class Mochitest(MochitestUtilsMixin):
|
||||
"""returns ordered list of output handlers"""
|
||||
return [self.fix_stack,
|
||||
self.format,
|
||||
self.record_last_test,
|
||||
self.dumpScreenOnTimeout,
|
||||
self.dumpScreenOnFail,
|
||||
self.metro_subprocess_id,
|
||||
self.trackShutdownLeaks,
|
||||
self.check_test_failure,
|
||||
self.log,
|
||||
self.record_last_test,
|
||||
]
|
||||
|
||||
def stackFixer(self):
|
||||
@ -1546,10 +1537,6 @@ class Mochitest(MochitestUtilsMixin):
|
||||
if self.shutdownLeaks:
|
||||
self.shutdownLeaks.process()
|
||||
|
||||
def log_output_buffer(self):
|
||||
if self.output_buffer:
|
||||
lines = [' %s' % line for line in self.output_buffer]
|
||||
log.info("Buffered test output:\n%s" % '\n'.join(lines))
|
||||
|
||||
# output line handlers:
|
||||
# these take a line and return a line
|
||||
@ -1563,15 +1550,19 @@ class Mochitest(MochitestUtilsMixin):
|
||||
"""format the line"""
|
||||
return line.rstrip().decode("UTF-8", "ignore")
|
||||
|
||||
def record_last_test(self, line):
|
||||
"""record last test on harness"""
|
||||
if "TEST-START" in line and "|" in line:
|
||||
self.harness.lastTestSeen = line.split("|")[1].strip()
|
||||
return line
|
||||
|
||||
def dumpScreenOnTimeout(self, line):
|
||||
if not self.dump_screen_on_fail and self.dump_screen_on_timeout and "TEST-UNEXPECTED-FAIL" in line and "Test timed out" in line:
|
||||
self.log_output_buffer()
|
||||
self.harness.dumpScreen(self.utilityPath)
|
||||
return line
|
||||
|
||||
def dumpScreenOnFail(self, line):
|
||||
if self.dump_screen_on_fail and "TEST-UNEXPECTED-FAIL" in line:
|
||||
self.log_output_buffer()
|
||||
self.harness.dumpScreen(self.utilityPath)
|
||||
return line
|
||||
|
||||
@ -1589,31 +1580,8 @@ class Mochitest(MochitestUtilsMixin):
|
||||
self.shutdownLeaks.log(line)
|
||||
return line
|
||||
|
||||
def check_test_failure(self, line):
|
||||
if 'TEST-END' in line:
|
||||
self.running_test = False
|
||||
if any('TEST-UNEXPECTED' in l for l in self.output_buffer):
|
||||
self.log_output_buffer()
|
||||
return line
|
||||
|
||||
def log(self, line):
|
||||
if self.hide_subtests and self.running_test:
|
||||
self.output_buffer.append(line)
|
||||
else:
|
||||
# hack to make separators align nicely, remove when we use mozlog
|
||||
if self.hide_subtests and 'TEST-END' in line:
|
||||
index = line.index('TEST-END') + len('TEST-END')
|
||||
line = line[:index] + ' ' * (len('TEST-START')-len('TEST-END')) + line[index:]
|
||||
log.info(line)
|
||||
return line
|
||||
|
||||
def record_last_test(self, line):
|
||||
"""record last test on harness"""
|
||||
if "TEST-START" in line and "|" in line:
|
||||
if not line.endswith('Shutdown'):
|
||||
self.output_buffer = []
|
||||
self.running_test = True
|
||||
self.harness.lastTestSeen = line.split("|")[1].strip()
|
||||
log.info(line)
|
||||
return line
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user