Bug 1136841 - Fix rungtests.py to check for crashes in the correct directory. r=ahal draft
authorChris Manchester <cmanchester@mozilla.com>
Thu, 07 Jan 2016 11:09:50 -0800
changeset 319771 56af4db5f741f0ee368fb74ffeeb637e42659713
parent 319338 1ec3a3ff68f2d1a54e6ed33e926c28fee286bdf1
child 512642 24373344e7932b00bdfb126422d483bf2ef399a6
push id9085
push usercmanchester@mozilla.com
push dateThu, 07 Jan 2016 19:12:11 +0000
reviewersahal
bugs1136841
milestone46.0a1
Bug 1136841 - Fix rungtests.py to check for crashes in the correct directory. r=ahal
testing/gtest/rungtests.py
--- a/testing/gtest/rungtests.py
+++ b/testing/gtest/rungtests.py
@@ -18,17 +18,17 @@ import mozprocess
 log = mozlog.unstructured.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, cwd=None):
+    def run_gtest(self, prog, xre_path, cwd, symbols_path=None):
         """
         Run a single C++ unit test program.
 
         Arguments:
         * prog: The path to the test program to run.
         * 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.
@@ -48,17 +48,17 @@ class GTests(object):
         #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("gtest | timed out after %d seconds", GTests.TEST_PROC_TIMEOUT)
             return False
-        if mozcrash.check_for_crashes(os.getcwd(), symbols_path, test_name="gtest"):
+        if mozcrash.check_for_crashes(cwd, 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("gtest | test failed with return code %d", proc.proc.returncode)
         return result
 
     def build_core_environment(self, env = {}):
@@ -148,18 +148,18 @@ def main():
     if not options.xre_path:
         print >>sys.stderr, """Error: --xre-path is required"""
         sys.exit(1)
     prog = os.path.abspath(args[0])
     options.xre_path = os.path.abspath(options.xre_path)
     tester = GTests()
     try:
         result = tester.run_gtest(prog, options.xre_path,
-                                  symbols_path=options.symbols_path,
-                                  cwd=options.cwd)
+                                  options.cwd,
+                                  symbols_path=options.symbols_path)
     except Exception, e:
         log.error(str(e))
         result = False
     sys.exit(0 if result else 1)
 
 if __name__ == '__main__':
     main()