Bug 1075240 - Log disabled tests as skips in mochitests. r=ahal
authorChris Manchester <cmanchester@mozilla.com>
Thu, 02 Oct 2014 11:08:41 -0400
changeset 209162 58012cbee5b65b729e12de2a860671b5dd18c8ed
parent 209161 33b673fb5f993d18009f638f4ba13e8fe2f51c74
child 209163 1878882312b0dbcf0144344313f05c82ac859b07
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersahal
bugs1075240
milestone35.0a1
Bug 1075240 - Log disabled tests as skips in mochitests. r=ahal
testing/mochitest/runtests.py
testing/mochitest/runtestsb2g.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -662,20 +662,16 @@ class MochitestUtilsMixin(object):
     tests = self.getActiveTests(options, disabled)
     paths = []
 
     for test in tests:
       if testsToFilter and (test['path'] not in testsToFilter):
         continue
       paths.append(test)
 
-    # suite_start message
-    flat_paths = [p['path'] for p in paths]
-    self.message_logger.logger.suite_start(flat_paths)
-
     # Bug 883865 - add this functionality into manifestparser
     with open(os.path.join(SCRIPT_DIR, 'tests.json'), 'w') as manifestFile:
       manifestFile.write(json.dumps({'tests': paths}))
     options.manifestFile = 'tests.json'
 
     return self.buildTestURL(options)
 
   def startWebSocketServer(self, options, debuggerInfo):
@@ -1616,25 +1612,35 @@ class Mochitest(MochitestUtilsMixin):
         path1 = ob1['path'].split('/')
         path2 = ob2['path'].split('/')
         return cmp(path1, path2)
 
     paths.sort(path_sort)
 
     return paths
 
+  def logPreamble(self, tests):
+    """Logs a suite_start message and test_start/test_end at the beginning of a run.
+    """
+    self.log.suite_start([t['path'] for t in tests])
+    for test in tests:
+      if 'disabled' in test:
+        self.log.test_start(test['path'])
+        self.log.test_end(test['path'], 'SKIP', message=test['disabled'])
+
   def getTestsToRun(self, options):
     """
       This method makes a list of tests that are to be run. Required mainly for --bisect-chunk.
     """
     tests = self.getActiveTests(options)
+    self.logPreamble(tests)
+
     testsToRun = []
     for test in tests:
       if test.has_key('disabled'):
-        self.log.info('TEST-SKIPPED | %s | %s' % (test['path'], test['disabled']))
         continue
       testsToRun.append(test['path'])
 
     return testsToRun
 
   def runMochitests(self, options, onLaunch=None):
     "This is a base method for calling other methods in this class for --bisect-chunk."
     testsToRun = self.getTestsToRun(options)
--- a/testing/mochitest/runtestsb2g.py
+++ b/testing/mochitest/runtestsb2g.py
@@ -108,16 +108,17 @@ class B2GMochitest(MochitestUtilsMixin):
         manifest = self.addChromeToProfile(options)
         self.copyExtraFilesToProfile(options)
         return manifest
 
     def run_tests(self, options):
         """ Prepare, configure, run tests and cleanup """
 
         manifest = self.build_profile(options)
+        self.logPreamble(self.getActiveTests(options))
 
         # configuring the message logger's buffering
         self.message_logger.buffering = options.quiet
 
         if options.debugger or not options.autorun:
             timeout = None
         else:
             if not options.timeout: