Bug 1307886 - [3.2] Extract xz-compressed libs for xpcshell and unit tests. r=glandium
authorEugen Sawin <esawin@mozilla.com>
Thu, 29 Sep 2016 17:56:22 +0200
changeset 346623 d523f32cf87f2122fbbca86e0e3d2d0a26942ab6
parent 346622 a4e85e8b39695146370873efafee0f881c565e81
child 346624 b6ab66ffae99eed12351041efd822efc6ae18858
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1307886
milestone52.0a1
Bug 1307886 - [3.2] Extract xz-compressed libs for xpcshell and unit tests. r=glandium
testing/remotecppunittests.py
testing/xpcshell/remotexpcshelltests.py
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -57,16 +57,23 @@ class RemoteCPPUnitTests(cppunittests.CP
                 apk_contents = ZipFile(self.options.local_apk)
 
                 for info in apk_contents.infolist():
                     if info.filename.endswith(".so"):
                         print >> sys.stderr, "Pushing %s.." % info.filename
                         remote_file = posixpath.join(self.remote_bin_dir, os.path.basename(info.filename))
                         apk_contents.extract(info, tmpdir)
                         local_file = os.path.join(tmpdir, info.filename)
+                        with open(local_file) as f:
+                            # Decompress xz-compressed file.
+                            if f.read(5)[1:] == '7zXZ':
+                                cmd = ['xz', '-df', '--suffix', '.so', local_file]
+                                subprocess.check_output(cmd)
+                                # xz strips the ".so" file suffix.
+                                os.rename(local_file[:-3], local_file)
                         self.device.pushFile(local_file, remote_file)
 
         elif self.options.local_lib:
             for file in os.listdir(self.options.local_lib):
                 if file.endswith(".so"):
                     print >> sys.stderr, "Pushing %s.." % file
                     remote_file = posixpath.join(self.remote_bin_dir, file)
                     local_file = os.path.join(self.options.local_lib, file)
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -448,16 +448,23 @@ class XPCShellRemote(xpcshell.XPCShellTe
             try:
                 dir = tempfile.mkdtemp()
                 for info in self.localAPKContents.infolist():
                     if info.filename.endswith(".so"):
                         print >> sys.stderr, "Pushing %s.." % info.filename
                         remoteFile = remoteJoin(self.remoteBinDir, os.path.basename(info.filename))
                         self.localAPKContents.extract(info, dir)
                         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)
                         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")):