Bug 904574 - Make gtests log output after crashes compatible with TBPL; r=BenWa
authorEd Morley <emorley@mozilla.com>
Tue, 13 Aug 2013 15:52:55 +0100
changeset 142411 a7ceae74e71af506989837397e840f8ea5c380c6
parent 142410 a4d217987888a46c72f0440715ee3f5f75e99432
child 142412 925bd252ae58b0255f31032d0ca13524073dd428
push id32391
push useremorley@mozilla.com
push dateTue, 13 Aug 2013 14:55:24 +0000
treeherdermozilla-inbound@925bd252ae58 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa
bugs904574
milestone26.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 904574 - Make gtests log output after crashes compatible with TBPL; r=BenWa
testing/gtest/rungtests.py
--- a/testing/gtest/rungtests.py
+++ b/testing/gtest/rungtests.py
@@ -5,17 +5,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import with_statement
 import sys, os, tempfile, shutil
 from optparse import OptionParser
 import mozprocess, mozinfo, mozlog, mozcrash
 from contextlib import contextmanager
 
-log = mozlog.getLogger('gtests')
+log = mozlog.getLogger('gtest')
 
 class GTests(object):
     # Time (seconds) to wait for test process to complete
     TEST_PROC_TIMEOUT = 1200
     # Time (seconds) in which process will be killed if it produces no output.
     TEST_PROC_NO_OUTPUT_TIMEOUT = 300
 
     def run_gtest(self, prog, xre_path, symbols_path=None):
@@ -27,38 +27,34 @@ class GTests(object):
         * env: The environment to use for running the program.
         * symbols_path: A path to a directory containing Breakpad-formatted
                         symbol files for producing stack traces on crash.
 
         Return True if the program exits with a zero status, False otherwise.
         """
         self.xre_path = xre_path
         env = self.build_environment()
-        basename = os.path.basename(prog)
-        log.info("Running test %s", basename)
+        log.info("Running gtest")
         proc = mozprocess.ProcessHandler([prog, "-unittest"],
                                          cwd=os.getcwd(),
                                          env=env)
         #TODO: After bug 811320 is fixed, don't let .run() kill the process,
         # instead use a timeout in .wait() and then kill to get a stack.
         proc.run(timeout=GTests.TEST_PROC_TIMEOUT,
                  outputTimeout=GTests.TEST_PROC_NO_OUTPUT_TIMEOUT)
         proc.wait()
         if proc.timedOut:
-            log.testFail("%s | timed out after %d seconds",
-                         basename, GTests.TEST_PROC_TIMEOUT)
+            log.testFail("gtest | timed out after %d seconds", GTests.TEST_PROC_TIMEOUT)
             return False
-        if mozcrash.check_for_crashes(os.getcwd(), symbols_path,
-                                      test_name=basename):
-            log.testFail("%s | test crashed", basename)
+        if mozcrash.check_for_crashes(os.getcwd(), symbols_path, test_name="gtest"):
+            # mozcrash will output the log failure line for us.
             return False
         result = proc.proc.returncode == 0
         if not result:
-            log.testFail("%s | test failed with return code %d",
-                         basename, proc.proc.returncode)
+            log.testFail("gtest | test failed with return code %d", proc.proc.returncode)
         return result
 
     def build_core_environment(self, env = {}):
         """
         Add environment variables likely to be used across all platforms, including remote systems.
         """
         env["MOZILLA_FIVE_HOME"] = self.xre_path
         env["MOZ_XRE_DIR"] = self.xre_path