Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: build/android/pylib/gtest/test_package_apk.py

Issue 14601004: [Android] Only reinstall test apk if needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/pylib/gtest/test_package_apk.py
diff --git a/build/android/pylib/gtest/test_package_apk.py b/build/android/pylib/gtest/test_package_apk.py
index 64e233e76e28b535f224c1fe2b6e1a09a211ab62..ac97e0fff0b2e38d50092c0f40f26b6c613aa554 100644
--- a/build/android/pylib/gtest/test_package_apk.py
+++ b/build/android/pylib/gtest/test_package_apk.py
@@ -115,12 +115,23 @@ class TestPackageApk(TestPackage):
logfile = android_commands.NewLineNormalizer(sys.stdout)
return self._WatchTestOutput(self._WatchFifo(timeout=10, logfile=logfile))
+ def _NeedsInstall(self):
+ pm_path_output = self.adb.RunShellCommand(
+ 'pm path ' + self._apk_package_name)
+ if not pm_path_output:
+ return True
+ # pm_path_output is of the form: "package:/path/to/foo.apk"
+ installed_apk_path = pm_path_output[0][8:]
craigdh 2013/05/06 16:59:56 nit: pm_path_output[0].split(':', 1)[1] or h[h.fin
cjhopman 2013/05/06 22:32:18 Done.
+ return not self.adb.CheckMd5Sum(
+ self.test_suite_full, installed_apk_path, ignore_paths=True)
+
def StripAndCopyExecutable(self):
self.tool.CopyFiles()
- # Always uninstall the previous one (by activity name); we don't
- # know what was embedded in it.
- self.adb.ManagedInstall(self.test_suite_full, False,
- package_name=self._apk_package_name)
+ if self._NeedsInstall():
+ # Always uninstall the previous one (by activity name); we don't
+ # know what was embedded in it.
+ self.adb.ManagedInstall(self.test_suite_full, False,
+ package_name=self._apk_package_name)
def _GetTestSuiteBaseName(self):
"""Returns the base name of the test suite."""
« build/android/pylib/android_commands.py ('K') | « build/android/pylib/android_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698