Bug 808417 - Make runTests() exception reporting consistent across test harnesses; r=jmaher
authorEd Morley <emorley@mozilla.com>
Mon, 05 Nov 2012 13:03:55 +0000
changeset 112300 267a4eb4b2368cc685847f7207ca9c843c84864d
parent 112299 4222b4c6a3e93ade8ae84c966d85cc9d3e9ea612
child 112301 60c78a559a84441c175506792d9f977a8f7a9113
push id23809
push useremorley@mozilla.com
push dateMon, 05 Nov 2012 15:24:12 +0000
treeherdermozilla-central@358c9830d166 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs808417
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 808417 - Make runTests() exception reporting consistent across test harnesses; r=jmaher
layout/tools/reftest/runreftestb2g.py
testing/mochitest/runtestsb2g.py
testing/mochitest/runtestsremote.py
testing/xpcshell/runtestsb2g.py
--- a/layout/tools/reftest/runreftestb2g.py
+++ b/layout/tools/reftest/runreftestb2g.py
@@ -542,17 +542,17 @@ def main(args=sys.argv[1:]):
             dm.killProcess(procName)
 
         cmdlineArgs = ["-reftest", manifest]
         if getattr(options, 'bootstrap', False):
             cmdlineArgs = []
 
         retVal = reftest.runTests(manifest, options, cmdlineArgs)
     except:
-        print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running tests." % sys.exc_info()[1]
+        print "Automation Error: Exception caught while running tests"
         traceback.print_exc()
         reftest.stopWebServer(options)
         try:
             reftest.cleanup(None)
         except:
             pass
         return 1
 
--- a/testing/mochitest/runtestsb2g.py
+++ b/testing/mochitest/runtestsb2g.py
@@ -483,17 +483,17 @@ def main():
     dm.mkDir(logParent)
     auto.setRemoteLog(options.remoteLogFile)
     auto.setServerInfo(options.webServer, options.httpPort, options.sslPort)
     retVal = 1
     try:
         mochitest.cleanup(None, options)
         retVal = mochitest.runTests(options)
     except:
-        print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running tests." % sys.exc_info()[1]
+        print "Automation Error: Exception caught while running tests"
         traceback.print_exc()
         mochitest.stopWebServer(options)
         mochitest.stopWebSocketServer(options)
         try:
             mochitest.cleanup(None, options)
         except:
             pass
             sys.exit(1)
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -2,16 +2,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import sys
 import os
 import time
 import tempfile
 import re
+import traceback
 
 sys.path.insert(0, os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0]))))
 
 from automation import Automation
 from remoteautomation import RemoteAutomation
 from runtests import Mochitest
 from runtests import MochitestOptions
 from runtests import MochitestServer
@@ -493,17 +494,18 @@ def main():
             options.browserArgs.append("%s.tests.%s" % (appname, test['name']))
             options.browserArgs.append("org.mozilla.roboexample.test/%s.FennecInstrumentationTestRunner" % appname)
 
             try:
                 dm.recordLogcat()
                 retVal = mochitest.runTests(options)
                 mochitest.addLogData()
             except:
-                print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running robocop tests." % sys.exc_info()[1]
+                print "Automation Error: Exception caught while running tests"
+                traceback.print_exc()
                 mochitest.stopWebServer(options)
                 mochitest.stopWebSocketServer(options)
                 try:
                     mochitest.cleanup(None, options)
                 except devicemanager.DMError:
                     # device error cleaning up... oh well!
                     pass
                 retVal = 1
@@ -516,17 +518,18 @@ def main():
             # 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)
         except:
-            print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running tests." % sys.exc_info()[1]
+            print "Automation Error: Exception caught while running tests"
+            traceback.print_exc()
             mochitest.stopWebServer(options)
             mochitest.stopWebSocketServer(options)
             try:
                 mochitest.cleanup(None, options)
             except devicemanager.DMError:
                 # device error cleaning up... oh well!
                 pass
             retVal = 1
--- a/testing/xpcshell/runtestsb2g.py
+++ b/testing/xpcshell/runtestsb2g.py
@@ -149,17 +149,17 @@ def main():
 
     options.remoteTestRoot = dm.getDeviceRoot()
 
     xpcsh = B2GXPCShellRemote(dm, options, args)
 
     try:
         success = xpcsh.runTests(xpcshell='xpcshell', testdirs=args[0:], **options.__dict__)
     except:
-        print "TEST-UNEXPECTED-FAIL | %s | Exception caught while running tests." % sys.exc_info()[1]
+        print "Automation Error: Exception caught while running tests"
         traceback.print_exc()
         sys.exit(1)
 
     sys.exit(int(success))
 
 
 # You usually run this like :
 # python runtestsb2g.py --emulator arm --b2gpath $B2GPATH --manifest $MANIFEST [--objdir $OBJDIR