From 190e9ca0885de561199740926d9ead1de999cea5 Mon Sep 17 00:00:00 2001 From: Eugen Sawin Date: Thu, 29 Sep 2016 17:56:22 +0200 Subject: [PATCH] Bug 1307886 - [3.2] Extract xz-compressed libs for xpcshell and unit tests. r=glandium --- testing/remotecppunittests.py | 7 +++++++ testing/xpcshell/remotexpcshelltests.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/testing/remotecppunittests.py b/testing/remotecppunittests.py index ba84c60c42ab..197cae8b4440 100644 --- a/testing/remotecppunittests.py +++ b/testing/remotecppunittests.py @@ -62,6 +62,13 @@ class RemoteCPPUnitTests(cppunittests.CPPUnitTests): 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: diff --git a/testing/xpcshell/remotexpcshelltests.py b/testing/xpcshell/remotexpcshelltests.py index e61b985c4814..c5124880f879 100644 --- a/testing/xpcshell/remotexpcshelltests.py +++ b/testing/xpcshell/remotexpcshelltests.py @@ -453,6 +453,13 @@ class XPCShellRemote(xpcshell.XPCShellTests, object): 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: