Bug 1389805 - Apply elfhack -r to Android xpcshell libs. r=jmaher, a=test-only
authorGeoff Brown <gbrown@mozilla.com>
Tue, 10 Apr 2018 11:14:16 -0600
changeset 463335 bb13bf12b0a326fee2a4b75171f024d5743034d0
parent 463334 5b90d07c0f0f6e622133fd609409edf8956814ec
child 463336 0baa437736c9a62df45c7fa4857478286e28adde
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs1389805
milestone60.0
Bug 1389805 - Apply elfhack -r to Android xpcshell libs. r=jmaher, a=test-only
testing/xpcshell/remotexpcshelltests.py
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -446,16 +446,22 @@ class XPCShellRemote(xpcshell.XPCShellTe
 
         if self.options['localAPK']:
             remoteFile = remoteJoin(self.remoteBinDir, os.path.basename(self.options['localAPK']))
             self.device.pushFile(self.options['localAPK'], remoteFile)
 
         self.pushLibs()
 
     def pushLibs(self):
+        elfhack = None
+        xrePath = self.options.get('xrePath')
+        if xrePath:
+            elfhack = os.path.join(xrePath, 'elfhack')
+            if not os.path.exists(elfhack):
+                elfhack = None
         pushed_libs_count = 0
         if self.options['localAPK']:
             try:
                 dir = tempfile.mkdtemp()
                 for info in self.localAPKContents.infolist():
                     if info.filename.endswith(".so"):
                         print("Pushing %s.." % info.filename, file=sys.stderr)
                         remoteFile = remoteJoin(self.remoteBinDir, os.path.basename(info.filename))
@@ -463,16 +469,20 @@ class XPCShellRemote(xpcshell.XPCShellTe
                         localFile = os.path.join(dir, info.filename)
                         with open(localFile) as f:
                             # Decompress xz-compressed file.
                             if f.read(5)[1:] == '7zXZ':
                                 cmd = ['xz', '-df', '--suffix', '.so', localFile]
                                 subprocess.check_output(cmd)
                                 # xz strips the ".so" file suffix.
                                 os.rename(localFile[:-3], localFile)
+                                # elfhack -r should provide better crash reports
+                                if elfhack:
+                                    cmd = [elfhack, '-r', localFile]
+                                    subprocess.check_output(cmd)
                         self.device.pushFile(localFile, remoteFile)
                         pushed_libs_count += 1
             finally:
                 shutil.rmtree(dir)
             return pushed_libs_count
 
         for file in os.listdir(self.localLib):
             if (file.endswith(".so")):