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

Side by Side Diff: build/android/pylib/remote/device/remote_device_gtest_run.py

Issue 833403002: [Android] Create a dummy app to upload to Appurify for gtests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add gn Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Run specific test on specific environment.""" 5 """Run specific test on specific environment."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import sys 9 import sys
10 10
11 from pylib import constants 11 from pylib import constants
12 from pylib.base import base_test_result 12 from pylib.base import base_test_result
13 from pylib.remote.device import appurify_sanitized 13 from pylib.remote.device import appurify_sanitized
14 from pylib.remote.device import remote_device_test_run 14 from pylib.remote.device import remote_device_test_run
15 from pylib.remote.device import remote_device_helper 15 from pylib.remote.device import remote_device_helper
16 16
17 17
18 class RemoteDeviceGtestRun(remote_device_test_run.RemoteDeviceTestRun): 18 class RemoteDeviceGtestRun(remote_device_test_run.RemoteDeviceTestRun):
19 """Run gtests and uirobot tests on a remote device.""" 19 """Run gtests and uirobot tests on a remote device."""
20 20
21 DEFAULT_RUNNER_TYPE = 'robotium'
22 DEFAULT_RUNNER_PACKAGE = ( 21 DEFAULT_RUNNER_PACKAGE = (
23 'org.chromium.native_test.ChromiumNativeTestInstrumentationTestRunner') 22 'org.chromium.native_test.ChromiumNativeTestInstrumentationTestRunner')
24 23
25 #override 24 #override
26 def TestPackage(self): 25 def TestPackage(self):
27 return self._test_instance.suite 26 return self._test_instance.suite
28 27
29 #override 28 #override
30 def _TriggerSetUp(self): 29 def _TriggerSetUp(self):
31 """Set up the triggering of a test run.""" 30 """Set up the triggering of a test run."""
32 logging.info('Triggering test run.') 31 logging.info('Triggering test run.')
33 self._app_id = self._UploadAppToDevice(self._test_instance.apk)
34 32
35 if not self._env.runner_type: 33 if self._env.runner_type:
36 runner_type = self.DEFAULT_RUNNER_TYPE 34 logging.warning('Ignoring configured runner_type "%s"',
37 logging.info('Using default runner type: %s', self.DEFAULT_RUNNER_TYPE) 35 self._env.runner_type)
38 else:
39 runner_type = self._env.runner_type
40 36
41 if not self._env.runner_package: 37 if not self._env.runner_package:
42 runner_package = self.DEFAULT_RUNNER_PACKAGE 38 runner_package = self.DEFAULT_RUNNER_PACKAGE
43 logging.info('Using default runner package: %s', 39 logging.info('Using default runner package: %s',
44 self.DEFAULT_RUNNER_TYPE) 40 self.DEFAULT_RUNNER_PACKAGE)
45 else: 41 else:
46 runner_package = self._env.runner_package 42 runner_package = self._env.runner_package
47 43
48 self._test_id = self._UploadTestToDevice(runner_type) 44 dummy_app_path = os.path.join(
49 config_body = {'runner': runner_package} 45 constants.GetOutDirectory(), 'apks', 'remote_device_dummy.apk')
50 self._SetTestConfig(runner_type, config_body) 46 self._AmInstrumentTestSetup(dummy_app_path, self._test_instance.apk,
47 runner_package)
51 48
52 _INSTRUMENTATION_STREAM_LEADER = 'INSTRUMENTATION_STATUS: stream=' 49 _INSTRUMENTATION_STREAM_LEADER = 'INSTRUMENTATION_STATUS: stream='
53 50
54 #override 51 #override
55 def _ParseTestResults(self): 52 def _ParseTestResults(self):
56 logging.info('Parsing results from stdout.') 53 logging.info('Parsing results from stdout.')
57 results = base_test_result.TestRunResults() 54 results = base_test_result.TestRunResults()
58 if self._results['results']['exception']: 55 if self._results['results']['exception']:
59 results.AddResult(base_test_result.BaseTestResult( 56 results.AddResult(base_test_result.BaseTestResult(
60 self._results['results']['exception'], 57 self._results['results']['exception'],
61 base_test_result.ResultType.FAIL)) 58 base_test_result.ResultType.FAIL))
62 else: 59 else:
63 output = self._results['results']['output'].splitlines() 60 output = self._results['results']['output'].splitlines()
64 output = (l[len(self._INSTRUMENTATION_STREAM_LEADER):] for l in output 61 output = (l[len(self._INSTRUMENTATION_STREAM_LEADER):] for l in output
65 if l.startswith(self._INSTRUMENTATION_STREAM_LEADER)) 62 if l.startswith(self._INSTRUMENTATION_STREAM_LEADER))
66 results_list = self._test_instance.ParseGTestOutput(output) 63 results_list = self._test_instance.ParseGTestOutput(output)
67 results.AddResults(results_list) 64 results.AddResults(results_list)
68 return results 65 return results
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698