Bug 822823 - Dump logcat on any robocop failure; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Thu, 10 Jan 2013 02:24:58 -0700
changeset 118408 927268cb78116fd88bc8a8ad9b72304d509f4f4c
parent 118407 ed308815b4a71239610cf057d0fe8dd8d106e5e2
child 118409 d70c9eb65c754602fef64c8e64af95597e3ecb66
push id24166
push userMs2ger@gmail.com
push dateFri, 11 Jan 2013 13:57:41 +0000
treeherdermozilla-central@63c4b0f66a0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs822823
milestone21.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 822823 - Dump logcat on any robocop failure; r=jmaher
testing/mochitest/runtestsremote.py
--- a/testing/mochitest/runtestsremote.py
+++ b/testing/mochitest/runtestsremote.py
@@ -358,30 +358,41 @@ class MochiRemote(Mochitest):
 
     # In the future we could use LogParser: http://hg.mozilla.org/automation/logparser/
     def addLogData(self):
         with open(self.localLog) as currentLog:
             data = currentLog.readlines()
 
         restart = re.compile('0 INFO SimpleTest START.*')
         reend = re.compile('([0-9]+) INFO TEST-START . Shutdown.*')
+        refail = re.compile('([0-9]+) INFO TEST-UNEXPECTED-FAIL.*')
         start_found = False
         end_found = False
+        fail_found = False
         for line in data:
             if reend.match(line):
                 end_found = True
                 start_found = False
-                return
+                break
 
             if start_found and not end_found:
                 # Append the line without the number to increment
                 self.logLines.append(' '.join(line.split(' ')[1:]))
 
             if restart.match(line):
                 start_found = True
+            if refail.match(line):
+                fail_found = True
+        result = 0
+        if fail_found:
+            result = 1
+        if not end_found:
+            print "ERROR: missing end of test marker (process crashed?)"
+            result = 1
+        return result
 
     def printLog(self):
         passed = 0
         failed = 0
         todo = 0
         incr = 1
         logFile = [] 
         logFile.append("0 INFO SimpleTest START")
@@ -526,21 +537,22 @@ def main():
             options.browserArgs.append("%s.tests.%s" % (options.remoteappname, test['name']))
             options.browserArgs.append("org.mozilla.roboexample.test/%s.FennecInstrumentationTestRunner" % options.remoteappname)
 
             try:
                 dm.recordLogcat()
                 result = mochitest.runTests(options)
                 if result != 0:
                     print "ERROR: runTests() exited with code %s" % result
+                log_result = mochitest.addLogData()
+                if result != 0 or log_result != 0:
                     mochitest.printDeviceInfo()
                 # Ensure earlier failures aren't overwritten by success on this run
                 if retVal is None or retVal == 0:
                     retVal = result
-                mochitest.addLogData()
             except:
                 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: