Bug 1265156 - always pass symbolsPath during xpcshell self tests; r=ted.mielczarek
authorNathan Froyd <froydnj.com>
Mon, 18 Apr 2016 13:20:35 -0400
changeset 331492 a73c2b09380d2c708c5c6aebef59eaa394343477
parent 331491 04d5b31350e4614d19e49bc080557458408546b4
child 331493 6e6c5143feaa28e2d374a9a12b30c090fa051093
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1265156
milestone48.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 1265156 - always pass symbolsPath during xpcshell self tests; r=ted.mielczarek If we botch things in libxul badly enough that startup cache precompilation works, but xpcshell self tests fail, it's nice to get understandable stacks for asserts or crashes inside libxul.
testing/xpcshell/selftest.py
old mode 100644
new mode 100755
--- a/testing/xpcshell/selftest.py
+++ b/testing/xpcshell/selftest.py
@@ -414,16 +414,20 @@ class XPCShellTestsTests(unittest.TestCa
         self.log = StringIO()
         self.tempdir = tempfile.mkdtemp()
         self.utility_path = os.path.join(objdir, 'dist', 'bin')
         logger = structured.commandline.setup_logging("selftest%s" % id(self),
                                                       {},
                                                       {"tbpl": self.log})
         self.x = XPCShellTests(logger)
         self.x.harness_timeout = 15
+        self.symbols_path = None
+        candidate_path = os.path.join(build_obj.distdir, 'crashreporter-symbols')
+        if (os.path.isdir(candidate_path)):
+          self.symbols_path = candidate_path
 
     def tearDown(self):
         shutil.rmtree(self.tempdir)
 
     def writeFile(self, name, contents):
         """
         Write |contents| to a file named |name| in the temp directory,
         and return the full path to the file.
@@ -449,25 +453,24 @@ class XPCShellTestsTests(unittest.TestCa
                 testlines.extend(t[1:])
         self.manifest = self.writeFile("xpcshell.ini", """
 [DEFAULT]
 head =
 tail =
 
 """ + "\n".join(testlines))
 
-    def assertTestResult(self, expected, shuffle=False, verbose=False,
-                         symbolsPath=None):
+    def assertTestResult(self, expected, shuffle=False, verbose=False):
         """
         Assert that self.x.runTests with manifest=self.manifest
         returns |expected|.
         """
         self.assertEquals(expected,
                           self.x.runTests(xpcshellBin,
-                                          symbolsPath=symbolsPath,
+                                          symbolsPath=self.symbols_path,
                                           manifest=self.manifest,
                                           mozInfo=mozinfo.info,
                                           shuffle=shuffle,
                                           verbose=verbose,
                                           sequential=True,
                                           testingModulesDir=os.path.join(objdir, '_tests', 'modules'),
                                           utility_path=self.utility_path),
                           msg="""Tests should have %s, log:
@@ -527,35 +530,27 @@ tail =
         self.assertNotInLog(TEST_PASS_STRING)
 
     @unittest.skipIf(mozinfo.isWin or not mozinfo.info.get('debug'),
                      'We don\'t have a stack fixer on hand for windows.')
     def testAssertStack(self):
         """
         When an assertion is hit, we should produce a useful stack.
         """
-        # Passing symbolsPath will cause the stack fixer to use
-        # fix_stack_using_bpsyms and exercise the fileid utility in
-        # this test.
-        symbolsPath = None
-        candidate_path = os.path.join(build_obj.distdir, 'crashreporter-symbols')
-        if os.path.isdir(candidate_path):
-          symbolsPath = candidate_path
-
         self.writeFile("test_assert.js", '''
           add_test(function test_asserts_immediately() {
             Components.classes["@mozilla.org/xpcom/debug;1"]
                       .getService(Components.interfaces.nsIDebug2)
                       .assertion("foo", "assertion failed", "test.js", 1)
             run_next_test();
           });
         ''')
 
         self.writeManifest(["test_assert.js"])
-        self.assertTestResult(False, symbolsPath=symbolsPath)
+        self.assertTestResult(False)
 
         self.assertInLog("###!!! ASSERTION")
         log_lines = self.log.getvalue().splitlines()
         line_pat = "#\d\d:"
         unknown_pat = "#\d\d\: \?\?\?\[.* \+0x[a-f0-9]+\]"
         self.assertFalse(any(re.search(unknown_pat, line) for line in log_lines),
                          "An stack frame without symbols was found in\n%s" % pprint.pformat(log_lines))
         self.assertTrue(any(re.search(line_pat, line) for line in log_lines),