Bug 808417 - Make runTests() exception reporting consistent across test harnesses; r=jmaher a=test-only
authorEd Morley <emorley@mozilla.com>
Mon, 12 Nov 2012 09:48:39 +0000
changeset 109809 f49b7d8ed734ece12a9a147210617402aace2abe
parent 109808 8b5a77ed01e83e5d29037cf33a107cf747d3cc0e
child 109810 9cfebbf2973a753a0c9c149d916a23487ffacec6
push id1688
push useremorley@mozilla.com
push dateMon, 12 Nov 2012 09:52:24 +0000
treeherdermozilla-beta@9cfebbf2973a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs808417
milestone17.0
Bug 808417 - Make runTests() exception reporting consistent across test harnesses; r=jmaher a=test-only
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
@@ -502,17 +502,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
@@ -437,17 +437,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
@@ -453,17 +454,18 @@ def main():
             options.browserArgs.append("org.mozilla.roboexample.test/android.test.InstrumentationTestRunner")
 
             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]
+                print "Automation Error: Exception caught while running tests"
+                traceback.print_exc()
                 mochitest.stopWebServer(options)
                 mochitest.stopWebSocketServer(options)
                 try:
                     self.cleanup(None, options)
                 except:
                     pass
                 sys.exit(1)
         if retVal is None:
@@ -472,17 +474,18 @@ def main():
 
         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]
+        print "Automation Error: Exception caught while running tests"
+        traceback.print_exc()
         mochitest.stopWebServer(options)
         mochitest.stopWebSocketServer(options)
         try:
             self.cleanup(None, options)
         except:
             pass
         sys.exit(1)
 
--- a/testing/xpcshell/runtestsb2g.py
+++ b/testing/xpcshell/runtestsb2g.py
@@ -141,17 +141,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