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

Unified Diff: build/android/pylib/local/device/local_device_instrumentation_test_run.py

Issue 2791613003: [Instrumentation Test Speed] Install apks in parallel with concurrent_adb enabled (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/local/device/local_device_instrumentation_test_run.py
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
index a8d9f5e6737828ccf5010f9070d4cdb553f407dd..55cab9ac57ca62d366b95c116829fc654555378a 100644
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -23,6 +23,8 @@ from py_trace_event import trace_event
from py_utils import contextlib_ext
import tombstones
+from multiprocessing.pool import ThreadPool
+
_TAG = 'test_runner_py'
TIMEOUT_ANNOTATIONS = [
@@ -75,29 +77,59 @@ class LocalDeviceInstrumentationTestRun(
self._env.BlacklistDevice)
@trace_event.traced
def individual_device_set_up(dev, host_device_tuples):
+ def single_apk_install(apk_permission_pair):
+ apk = apk_permission_pair[0]
+ permissions = apk_permission_pair[1]
+ dev.Install(apk, permissions=permissions)
+
+ def single_incremental_apk_install(dev_apk_script_array):
+ dev = dev_apk_script_array[0]
+ apk = dev_apk_script_array[1]
+ incremental_install_script = dev_apk_script_array[2]
+ local_device_test_run.IncrementalInstall(
+ dev, apk, incremental_install_script)
+
+ def single_apk_install_helper(array):
+ if len(array) == 2:
+ single_apk_install(array)
+ elif len(array) == 3:
+ single_incremental_apk_install(array)
+ else:
+ raise Exception('incorrect input array')
+
+ @trace_event.traced
def install_apk():
+ apk_resource_array = []
if self._test_instance.apk_under_test:
if self._test_instance.apk_under_test_incremental_install_script:
- local_device_test_run.IncrementalInstall(
+ apk_resource_array.append([
dev,
self._test_instance.apk_under_test,
- self._test_instance.apk_under_test_incremental_install_script)
+ self._test_instance.apk_under_test_incremental_install_script])
else:
permissions = self._test_instance.apk_under_test.GetPermissions()
- dev.Install(self._test_instance.apk_under_test,
- permissions=permissions)
+ apk_resource_array.append(
+ [self._test_instance.apk_under_test, permissions])
if self._test_instance.test_apk_incremental_install_script:
- local_device_test_run.IncrementalInstall(
+ apk_resource_array.append([
dev,
self._test_instance.test_apk,
- self._test_instance.test_apk_incremental_install_script)
+ self._test_instance.test_apk_incremental_install_script])
else:
permissions = self._test_instance.test_apk.GetPermissions()
- dev.Install(self._test_instance.test_apk, permissions=permissions)
+ apk_resource_array.append(
+ [self._test_instance.test_apk, permissions])
for apk in self._test_instance.additional_apks:
- dev.Install(apk)
+ apk_resource_array.append([apk, None])
+
+ if self._env.concurrent_adb:
+ pool = ThreadPool(processes=len(apk_resource_array))
jbudorick 2017/04/01 00:58:19 Instead of using a ThreadPool, split apk installat
+ pool.map(single_apk_install_helper, apk_resource_array)
+ else:
+ for apk_resource in apk_resource_array:
+ single_apk_install_helper(apk_resource)
# Set debug app in order to enable reading command line flags on user
# builds
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698