Bug 1471724 - [mochitest] Provide better 'lastTestSeen' strings to differentiate the end of a test draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 28 Jun 2018 10:27:38 -0400
changeset 812018 f5a3a7701033b24cc126f12eb10d90d1539274cb
parent 811977 6041c030780420b6205cf2d6640513606609884c
push id114451
push userahalberstadt@mozilla.com
push dateThu, 28 Jun 2018 14:38:27 +0000
bugs1471724
milestone63.0a1
Bug 1471724 - [mochitest] Provide better 'lastTestSeen' strings to differentiate the end of a test MozReview-Commit-ID: B6g8JrIJuJw
testing/mochitest/runtests.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -862,16 +862,17 @@ class MochitestDesktop(object):
         self.server = None
         self.wsserver = None
         self.websocketProcessBridge = None
         self.sslTunnel = None
         self.manifest = None
         self.tests_by_manifest = defaultdict(list)
         self.prefs_by_manifest = defaultdict(set)
         self._active_tests = None
+        self.currentTests = None
         self._locations = None
 
         self.marionette = None
         self.start_script = None
         self.mozLogs = None
         self.start_script_kwargs = {}
         self.urlOpts = []
 
@@ -2767,16 +2768,17 @@ toolbar#nav-bar {
             # testsToFilter parameter is used to filter out the test list that
             # is sent to getTestsByScheme
             for (scheme, tests) in self.getTestsByScheme(options, testsToFilter):
                 # read the number of tests here, if we are not going to run any,
                 # terminate early
                 if not tests:
                     continue
 
+                self.currentTests = [t['path'] for t in tests]
                 testURL = self.buildTestURL(options, scheme=scheme)
 
                 self.buildURLOptions(options, self.browserEnv)
                 if self.urlOpts:
                     testURL += "?" + "&".join(self.urlOpts)
 
                 self.log.info("runtests.py | Running with e10s: {}".format(options.e10s))
                 self.log.info("runtests.py | Running tests: start.\n")
@@ -3025,16 +3027,21 @@ toolbar#nav-bar {
                 elif message['action'] == 'process_output':
                     message['data'] = self.stackFixerFunction(message['data'])
             return message
 
         def record_last_test(self, message):
             """record last test on harness"""
             if message['action'] == 'test_start':
                 self.harness.lastTestSeen = message['test']
+            elif message['action'] == 'test_end':
+                if self.harness.currentTests and message['test'] == self.harness.currentTests[-1]:
+                    self.harness.lastTestSeen = 'Last test finished'
+                else:
+                    self.harness.lastTestSeen = '{} (finished)'.format(message['test'])
             return message
 
         def dumpScreenOnTimeout(self, message):
             if (not self.dump_screen_on_fail
                     and self.dump_screen_on_timeout
                     and message['action'] == 'test_status' and 'expected' in message
                     and "Test timed out" in message['subtest']):
                 self.harness.dumpScreen(self.utilityPath)