Bug 1229379 - use mozlog test report protocol in talos. r=jmaher draft
authorJulien Pagès <j.parkouss@gmail.com>
Mon, 14 Dec 2015 15:15:42 +0100
changeset 316011 8a209e375573f0e4a58b40558d022bb2d0d5f517
parent 316010 4df87a84261e324468a0fc29a37b15e929ac736d
child 512113 099926d14c90235d90eedae037cf7b3b04ab3c8a
push id8495
push userj.parkouss@gmail.com
push dateThu, 17 Dec 2015 16:32:18 +0000
reviewersjmaher
bugs1229379
milestone46.0a1
Bug 1229379 - use mozlog test report protocol in talos. r=jmaher
testing/talos/talos/run_tests.py
--- a/testing/talos/talos/run_tests.py
+++ b/testing/talos/talos/run_tests.py
@@ -12,17 +12,17 @@ import traceback
 import urllib
 import utils
 import mozhttpd
 
 from mozlog import get_proxy_logger
 
 from talos.results import TalosResults
 from talos.ttest import TTest
-from talos.utils import TalosError, TalosCrash, TalosRegression
+from talos.utils import TalosError, TalosRegression
 from talos.config import get_configs, ConfigurationError
 
 # directory of this file
 here = os.path.dirname(os.path.realpath(__file__))
 LOG = get_proxy_logger()
 
 
 def useBaseTestDefaults(base, tests):
@@ -179,44 +179,46 @@ def run_tests(config, browser_config):
             datazilla_urls=[os.path.abspath('local.json')]
         )
     talos_results.check_output_formats(results_urls)
 
     httpd = setup_webserver(browser_config['webserver'])
     httpd.start()
 
     testname = None
+    # run the tests
+    timer = utils.Timer()
+    LOG.suite_start(tests=[test['name'] for test in tests])
     try:
-        # run the tests
-        timer = utils.Timer()
-        LOG.info("Starting test suite %s" % title)
         for test in tests:
             testname = test['name']
-            testtimer = utils.Timer()
-            LOG.info("Starting test %s" % testname)
+            LOG.test_start(testname)
 
             mytest = TTest()
             talos_results.add(mytest.runTest(browser_config, test))
 
-            LOG.info("Completed test %s (%s)"
-                     % (testname,  testtimer.elapsed()))
+            LOG.test_end(testname, status='OK')
 
-    except TalosRegression:
+    except TalosRegression as exc:
         LOG.error("Detected a regression for %s" % testname)
         # by returning 1, we report an orange to buildbot
         # http://docs.buildbot.net/latest/developer/results.html
+        LOG.test_end(testname, status='FAIL', message=unicode(exc),
+                     stack=traceback.format_exc())
         return 1
-    except (TalosCrash, TalosError):
+    except Exception as exc:
         # NOTE: if we get into this condition, talos has an internal
         # problem and cannot continue
         #       this will prevent future tests from running
-        traceback.print_exception(*sys.exc_info())
+        LOG.test_end(testname, status='ERROR', message=unicode(exc),
+                     stack=traceback.format_exc())
         # indicate a failure to buildbot, turn the job red
         return 2
     finally:
+        LOG.suite_end()
         httpd.stop()
 
     LOG.info("Completed test suite (%s)" % timer.elapsed())
 
     # output results
     if results_urls:
         talos_results.output(results_urls)
         if browser_config['develop']: