Bug 801652 - Make sure we print logcat, device info on remote mochitest/reftest failure;r=jmaher

This commit is contained in:
William Lachance 2012-10-24 13:34:33 -04:00
Родитель d241ae5621
Коммит cfb9c86b64
2 изменённых файлов: 39 добавлений и 28 удалений

Просмотреть файл

@ -13,7 +13,7 @@ SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])
from runreftest import RefTest
from runreftest import ReftestOptions
from automation import Automation
import devicemanager, devicemanagerADB, devicemanagerSUT
import devicemanager, devicemanagerADB, devicemanagerSUT, devicemanager
from remoteautomation import RemoteAutomation
class RemoteOptions(ReftestOptions):
@ -435,23 +435,26 @@ def main(args):
#an example manifest name to use on the cli
# manifest = "http://" + options.remoteWebServer + "/reftests/layout/reftests/reftest-sanity/reftest.list"
logcat = []
retVal = 0
try:
cmdlineArgs = ["-reftest", manifest]
if options.bootstrap:
cmdlineArgs = []
dm.recordLogcat()
reftest.runTests(manifest, options, cmdlineArgs)
logcat = dm.getLogcat()
except:
print "TEST-UNEXPECTED-FAIL | | exception while running reftests"
reftest.stopWebServer(options)
return 1
retVal = 1
reftest.stopWebServer(options)
print ''.join(logcat[-500:-1])
print dm.getInfo()
return 0
try:
logcat = dm.getLogcat()
print ''.join(logcat[-500:-1])
print dm.getInfo()
except devicemanager.DMError:
print "WARNING: Error getting device information at end of test"
return retVal
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))

Просмотреть файл

@ -462,7 +462,7 @@ def main():
procName = options.app.split('/')[-1]
if (dm.processExist(procName)):
dm.killProcess(procName)
if options.robocop != "":
mp = manifestparser.TestManifest(strict=False)
# TODO: pull this in dynamically
@ -484,7 +484,6 @@ def main():
appname = options.app
retVal = None
logcat = []
for test in robocop_tests:
if options.testPath and options.testPath != test['name']:
continue
@ -497,39 +496,48 @@ def main():
try:
dm.recordLogcat()
retVal = mochitest.runTests(options)
logcat = dm.getLogcat()
mochitest.addLogData()
except:
print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running robocop tests." % sys.exc_info()[1]
mochitest.stopWebServer(options)
mochitest.stopWebSocketServer(options)
try:
self.cleanup(None, options)
except:
mochitest.cleanup(None, options)
except devicemanager.DMError:
# device error cleaning up... oh well!
pass
sys.exit(1)
retVal = 1
break
if retVal is None:
print "No tests run. Did you pass an invalid TEST_PATH?"
retVal = 1
retVal = mochitest.printLog()
if retVal == 0:
# if we didn't have some kind of error running the tests, make
# sure the tests actually passed
retVal = mochitest.printLog()
else:
try:
dm.recordLogcat()
retVal = mochitest.runTests(options)
logcat = dm.getLogcat()
except:
print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running tests." % sys.exc_info()[1]
mochitest.stopWebServer(options)
mochitest.stopWebSocketServer(options)
try:
self.cleanup(None, options)
dm.recordLogcat()
retVal = mochitest.runTests(options)
except:
pass
sys.exit(1)
print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running tests." % sys.exc_info()[1]
mochitest.stopWebServer(options)
mochitest.stopWebSocketServer(options)
try:
mochitest.cleanup(None, options)
except devicemanager.DMError:
# device error cleaning up... oh well!
pass
retVal = 1
try:
logcat = dm.getLogcat()
print ''.join(logcat[-500:-1])
print dm.getInfo()
except devicemanager.DMError:
print "WARNING: Error getting device information at end of test"
print ''.join(logcat[-500:-1])
print dm.getInfo()
sys.exit(retVal)
if __name__ == "__main__":