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

Unified Diff: build/android/pylib/remote/device/remote_device_uirobot_test_run.py

Issue 1415533007: [Android] Add sharding for AMP instrumentation tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/remote/device/remote_device_uirobot_test_run.py
diff --git a/build/android/pylib/remote/device/remote_device_uirobot_test_run.py b/build/android/pylib/remote/device/remote_device_uirobot_test_run.py
index f99e685084b97b21a60a00ae5f298e54c7d3deb9..977ea288da6992dfb2adf23fdb445ce580a1636c 100644
--- a/build/android/pylib/remote/device/remote_device_uirobot_test_run.py
+++ b/build/android/pylib/remote/device/remote_device_uirobot_test_run.py
@@ -6,6 +6,7 @@
import logging
+from devil.utils import reraiser_thread
from pylib.base import base_test_result
from pylib.remote.device import appurify_sanitized
from pylib.remote.device import remote_device_test_run
@@ -26,60 +27,74 @@ class RemoteDeviceUirobotTestRun(remote_device_test_run.RemoteDeviceTestRun):
super(RemoteDeviceUirobotTestRun, self).__init__(env, test_instance)
#override
- def TestPackage(self):
- return self._test_instance.package_name
+ def _GetAppPath(self):
+ return self._test_instance.app_under_test
#override
- def _TriggerSetUp(self):
- """Set up the triggering of a test run."""
- logging.info('Triggering test run.')
-
- if self._env.device_type == 'Android':
- default_runner_type = 'android_robot'
+ def _GetTestFramework(self):
+ if self._env.test_framework:
+ return self._env.test_framework
+ elif self._env.device_type == 'Android':
+ return 'android_robot'
elif self._env.device_type == 'iOS':
- default_runner_type = 'ios_robot'
+ return 'ios_robot'
else:
raise remote_device_helper.RemoteDeviceError(
'Unknown device type: %s' % self._env.device_type)
- self._app_id = self._UploadAppToDevice(self._test_instance.app_under_test)
- if not self._env.runner_type:
- runner_type = default_runner_type
- logging.info('Using default runner type: %s', default_runner_type)
- else:
- runner_type = self._env.runner_type
+ #override
+ def _ShouldShard(self):
+ return False
- self._test_id = self._UploadTestToDevice(
- 'android_robot', None, app_id=self._app_id)
- config_body = {'duration': self._test_instance.minutes}
- self._SetTestConfig(runner_type, config_body)
+ #override
+ def _SetupTestShards(self, num_shards):
+ test_ids = []
+ framework_configs = {'duration': self._test_instance.minutes}
+
+ def upload_test_shards():
+ test_id = self._UploadTestToDevice(None)
+ self._UploadTestConfigToDevice(
+ test_id, framework_configs, self._appurify_configs)
+ test_ids.append(test_id)
+
+ workers = reraiser_thread.ReraiserThreadGroup(
rnephew (Wrong account) 2015/11/04 22:22:03 Since _ShouldShard() returns False, is it necessar
mikecase (-- gone --) 2015/11/05 23:17:41 Yeah, I'll add a RunThreadsSync function to rerais
+ [reraiser_thread.ReraiserThread(
+ upload_test_shards,
+ name='upload test shard %d' % i)
+ for i in xrange(num_shards)])
+ workers.StartAll()
+ workers.JoinAll()
+ return test_ids
+ #override
+ def TestPackage(self):
+ return self._test_instance.package_name
# TODO(rnephew): Switch to base class implementation when supported.
#override
- def _UploadTestToDevice(self, test_type, test_path, app_id=None):
- if test_path:
- logging.info("Ignoring test path.")
+ def _UploadTestToDevice(self, test_path):
data = {
- 'access_token':self._env.token,
- 'test_type':test_type,
- 'app_id':app_id,
+ 'access_token': self._env.token,
+ 'test_type': self._GetTestFramework(),
+ 'app_id': self._app_id,
}
with appurify_sanitized.SanitizeLogging(self._env.verbose_count,
logging.WARNING):
- test_upload_res = appurify_sanitized.utils.post('tests/upload',
- data, None)
- remote_device_helper.TestHttpResponse(
- test_upload_res, 'Unable to get UiRobot test id.')
- return test_upload_res.json()['response']['test_id']
+ test_upload_response = appurify_sanitized.utils.post(
+ resource='tests/upload', data=data, files=None)
+ remote_device_helper.TestHttpResponse(test_upload_response,
+ 'Unable to get UiRobot test id.')
+ return test_upload_response.json()['response']['test_id']
#override
- def _ParseTestResults(self):
+ def _ParseTestResults(self, test_output, results_zip):
logging.info('Parsing results from remote service.')
results = base_test_result.TestRunResults()
- if self._results['results']['pass']:
+ if test_output['results']['pass']:
result_type = base_test_result.ResultType.PASS
else:
result_type = base_test_result.ResultType.FAIL
results.AddResult(base_test_result.BaseTestResult('uirobot', result_type))
+ remote_device_test_run.DetectPlatformErrors(
+ results, test_output, results_zip)
return results

Powered by Google App Engine
This is Rietveld 408576698