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:
@@ -814,7 +814,7 @@ class Automation(object):
|
|||||||
xrePath = None, certPath = None,
|
xrePath = None, certPath = None,
|
||||||
debuggerInfo = None, symbolsPath = None,
|
debuggerInfo = None, symbolsPath = None,
|
||||||
timeout = -1, maxTime = None, onLaunch = 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.
|
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.
|
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.')
|
help='If running tests by chunks, the number of the chunk to run.')
|
||||||
func = this_chunk(func)
|
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',
|
debug_on_failure = CommandArgument('--debug-on-failure', action='store_true',
|
||||||
help='Breaks execution and enters the JS debugger on a test failure. ' \
|
help='Breaks execution and enters the JS debugger on a test failure. ' \
|
||||||
'Should be used together with --jsdebugger.')
|
'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.')
|
help='If running tests by chunks, the number of the chunk to run.')
|
||||||
func = this_chunk(func)
|
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='*',
|
path = CommandArgument('test_paths', default=None, nargs='*',
|
||||||
metavar='TEST',
|
metavar='TEST',
|
||||||
help='Test to run. Can be specified as a single file, a ' \
|
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",
|
"help": "file to which logging occurs",
|
||||||
"default": "",
|
"default": "",
|
||||||
}],
|
}],
|
||||||
[["--hide-subtests"],
|
|
||||||
{ "action": "store_true",
|
|
||||||
"dest": "hide_subtests",
|
|
||||||
"help": "only show subtest log output if there was a failure",
|
|
||||||
"default": False,
|
|
||||||
}],
|
|
||||||
[["--autorun"],
|
[["--autorun"],
|
||||||
{ "action": "store_true",
|
{ "action": "store_true",
|
||||||
"dest": "autorun",
|
"dest": "autorun",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import traceback
|
|||||||
import urllib2
|
import urllib2
|
||||||
import zipfile
|
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 datetime import datetime
|
||||||
from manifestparser import TestManifest
|
from manifestparser import TestManifest
|
||||||
from mochitest_options import MochitestOptions
|
from mochitest_options import MochitestOptions
|
||||||
@@ -1176,7 +1176,6 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
timeout=-1,
|
timeout=-1,
|
||||||
onLaunch=None,
|
onLaunch=None,
|
||||||
webapprtChrome=False,
|
webapprtChrome=False,
|
||||||
hide_subtests=False,
|
|
||||||
screenshotOnFail=False):
|
screenshotOnFail=False):
|
||||||
"""
|
"""
|
||||||
Run the app, log the duration it took to execute, return the status code.
|
Run the app, log the duration it took to execute, return the status code.
|
||||||
@@ -1236,12 +1235,10 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
symbolsPath=symbolsPath,
|
symbolsPath=symbolsPath,
|
||||||
dump_screen_on_timeout=not debuggerInfo,
|
dump_screen_on_timeout=not debuggerInfo,
|
||||||
dump_screen_on_fail=screenshotOnFail,
|
dump_screen_on_fail=screenshotOnFail,
|
||||||
hide_subtests=hide_subtests,
|
|
||||||
shutdownLeaks=shutdownLeaks,
|
shutdownLeaks=shutdownLeaks,
|
||||||
)
|
)
|
||||||
|
|
||||||
def timeoutHandler():
|
def timeoutHandler():
|
||||||
outputHandler.log_output_buffer()
|
|
||||||
browserProcessId = outputHandler.browserProcessId
|
browserProcessId = outputHandler.browserProcessId
|
||||||
self.handleTimeout(timeout, proc, utilityPath, debuggerInfo, browserProcessId)
|
self.handleTimeout(timeout, proc, utilityPath, debuggerInfo, browserProcessId)
|
||||||
kp_kwargs = {'kill_on_timeout': False,
|
kp_kwargs = {'kill_on_timeout': False,
|
||||||
@@ -1411,7 +1408,6 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
onLaunch=onLaunch,
|
onLaunch=onLaunch,
|
||||||
webapprtChrome=options.webapprtChrome,
|
webapprtChrome=options.webapprtChrome,
|
||||||
hide_subtests=options.hide_subtests,
|
|
||||||
screenshotOnFail=options.screenshotOnFail
|
screenshotOnFail=options.screenshotOnFail
|
||||||
)
|
)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
@@ -1453,20 +1449,16 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
|
|
||||||
class OutputHandler(object):
|
class OutputHandler(object):
|
||||||
"""line output handler for mozrunner"""
|
"""line output handler for mozrunner"""
|
||||||
def __init__(self, harness, utilityPath, symbolsPath=None, dump_screen_on_timeout=True, dump_screen_on_fail=False,
|
def __init__(self, harness, utilityPath, symbolsPath=None, dump_screen_on_timeout=True, dump_screen_on_fail=False, shutdownLeaks=None):
|
||||||
hide_subtests=False, shutdownLeaks=None):
|
|
||||||
"""
|
"""
|
||||||
harness -- harness instance
|
harness -- harness instance
|
||||||
dump_screen_on_timeout -- whether to dump the screen on timeout
|
dump_screen_on_timeout -- whether to dump the screen on timeout
|
||||||
"""
|
"""
|
||||||
self.harness = harness
|
self.harness = harness
|
||||||
self.output_buffer = []
|
|
||||||
self.running_test = False
|
|
||||||
self.utilityPath = utilityPath
|
self.utilityPath = utilityPath
|
||||||
self.symbolsPath = symbolsPath
|
self.symbolsPath = symbolsPath
|
||||||
self.dump_screen_on_timeout = dump_screen_on_timeout
|
self.dump_screen_on_timeout = dump_screen_on_timeout
|
||||||
self.dump_screen_on_fail = dump_screen_on_fail
|
self.dump_screen_on_fail = dump_screen_on_fail
|
||||||
self.hide_subtests = hide_subtests
|
|
||||||
self.shutdownLeaks = shutdownLeaks
|
self.shutdownLeaks = shutdownLeaks
|
||||||
|
|
||||||
# perl binary to use
|
# perl binary to use
|
||||||
@@ -1490,13 +1482,12 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
"""returns ordered list of output handlers"""
|
"""returns ordered list of output handlers"""
|
||||||
return [self.fix_stack,
|
return [self.fix_stack,
|
||||||
self.format,
|
self.format,
|
||||||
|
self.record_last_test,
|
||||||
self.dumpScreenOnTimeout,
|
self.dumpScreenOnTimeout,
|
||||||
self.dumpScreenOnFail,
|
self.dumpScreenOnFail,
|
||||||
self.metro_subprocess_id,
|
self.metro_subprocess_id,
|
||||||
self.trackShutdownLeaks,
|
self.trackShutdownLeaks,
|
||||||
self.check_test_failure,
|
|
||||||
self.log,
|
self.log,
|
||||||
self.record_last_test,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def stackFixer(self):
|
def stackFixer(self):
|
||||||
@@ -1546,10 +1537,6 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
if self.shutdownLeaks:
|
if self.shutdownLeaks:
|
||||||
self.shutdownLeaks.process()
|
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:
|
# output line handlers:
|
||||||
# these take a line and return a line
|
# these take a line and return a line
|
||||||
@@ -1563,15 +1550,19 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
"""format the line"""
|
"""format the line"""
|
||||||
return line.rstrip().decode("UTF-8", "ignore")
|
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):
|
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:
|
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)
|
self.harness.dumpScreen(self.utilityPath)
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def dumpScreenOnFail(self, line):
|
def dumpScreenOnFail(self, line):
|
||||||
if self.dump_screen_on_fail and "TEST-UNEXPECTED-FAIL" in line:
|
if self.dump_screen_on_fail and "TEST-UNEXPECTED-FAIL" in line:
|
||||||
self.log_output_buffer()
|
|
||||||
self.harness.dumpScreen(self.utilityPath)
|
self.harness.dumpScreen(self.utilityPath)
|
||||||
return line
|
return line
|
||||||
|
|
||||||
@@ -1589,33 +1580,10 @@ class Mochitest(MochitestUtilsMixin):
|
|||||||
self.shutdownLeaks.log(line)
|
self.shutdownLeaks.log(line)
|
||||||
return 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):
|
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)
|
log.info(line)
|
||||||
return 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()
|
|
||||||
return line
|
|
||||||
|
|
||||||
|
|
||||||
def makeTestConfig(self, options):
|
def makeTestConfig(self, options):
|
||||||
"Creates a test configuration file for customizing test execution."
|
"Creates a test configuration file for customizing test execution."
|
||||||
|
|||||||
Reference in New Issue
Block a user