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

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 19799003: [android] Instumentation tests determine whether to install test apk based on Md5Sum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: automatically install package to be tested Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Class for running instrumentation tests on a single device.""" 5 """Class for running instrumentation tests on a single device."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import shutil 10 import shutil
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 _DEVICE_PERF_OUTPUT_SEARCH_PREFIX = (constants.DEVICE_PERF_OUTPUT_DIR + 51 _DEVICE_PERF_OUTPUT_SEARCH_PREFIX = (constants.DEVICE_PERF_OUTPUT_DIR +
52 '/chrome-profile*') 52 '/chrome-profile*')
53 _DEVICE_HAS_TEST_FILES = {} 53 _DEVICE_HAS_TEST_FILES = {}
54 54
55 def __init__(self, options, device, shard_index, test_pkg, ports_to_forward): 55 def __init__(self, options, device, shard_index, test_pkg, ports_to_forward):
56 """Create a new TestRunner. 56 """Create a new TestRunner.
57 57
58 Args: 58 Args:
59 options: An options object with the following required attributes: 59 options: An options object with the following required attributes:
60 - build_type: 'Release' or 'Debug'. 60 - build_type: 'Release' or 'Debug'.
61 - install_apk: Re-installs the apk if opted.
62 - save_perf_json: Whether or not to save the JSON file from UI perf 61 - save_perf_json: Whether or not to save the JSON file from UI perf
63 tests. 62 tests.
64 - screenshot_failures: Take a screenshot for a test failure 63 - screenshot_failures: Take a screenshot for a test failure
65 - tool: Name of the Valgrind tool. 64 - tool: Name of the Valgrind tool.
66 - wait_for_debugger: blocks until the debugger is connected. 65 - wait_for_debugger: blocks until the debugger is connected.
67 - disable_assertions: Whether to disable java assertions on the device. 66 - disable_assertions: Whether to disable java assertions on the device.
68 - push_deps: If True, push all dependencies to the device. 67 - push_deps: If True, push all dependencies to the device.
69 - cleanup_test_files: Whether or not to cleanup test files on device. 68 - cleanup_test_files: Whether or not to cleanup test files on device.
70 device: Attached android device. 69 device: Attached android device.
71 shard_index: Shard index. 70 shard_index: Shard index.
72 test_pkg: A TestPackage object. 71 test_pkg: A TestPackage object.
73 ports_to_forward: A list of port numbers for which to set up forwarders. 72 ports_to_forward: A list of port numbers for which to set up forwarders.
74 Can be optionally requested by a test case. 73 Can be optionally requested by a test case.
75 """ 74 """
76 super(TestRunner, self).__init__( 75 super(TestRunner, self).__init__(
77 device, options.tool, options.build_type, options.push_deps, 76 device, options.tool, options.build_type, options.push_deps,
78 options.cleanup_test_files) 77 options.cleanup_test_files)
79 self._lighttp_port = constants.LIGHTTPD_RANDOM_PORT_FIRST + shard_index 78 self._lighttp_port = constants.LIGHTTPD_RANDOM_PORT_FIRST + shard_index
80 79
81 self.build_type = options.build_type 80 self.build_type = options.build_type
82 self.test_data = options.test_data 81 self.test_data = options.test_data
83 self.save_perf_json = options.save_perf_json 82 self.save_perf_json = options.save_perf_json
84 self.screenshot_failures = options.screenshot_failures 83 self.screenshot_failures = options.screenshot_failures
85 self.wait_for_debugger = options.wait_for_debugger 84 self.wait_for_debugger = options.wait_for_debugger
86 self.disable_assertions = options.disable_assertions 85 self.disable_assertions = options.disable_assertions
87 self.test_pkg = test_pkg 86 self.test_pkg = test_pkg
88 self.ports_to_forward = ports_to_forward 87 self.ports_to_forward = ports_to_forward
89 self.install_apk = options.install_apk
frankf 2013/07/20 02:18:35 Rebase
craigdh 2013/07/22 19:03:14 Done.
90 88
91 #override 89 #override
92 def InstallTestPackage(self): 90 def InstallTestPackage(self):
93 if self.install_apk: 91 self.test_pkg.Install(self.adb)
94 self.test_pkg.Install(self.adb)
95 92
96 #override 93 #override
97 def PushDataDeps(self): 94 def PushDataDeps(self):
98 # TODO(frankf): Implement a general approach for copying/installing 95 # TODO(frankf): Implement a general approach for copying/installing
99 # once across test runners. 96 # once across test runners.
100 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): 97 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False):
101 logging.warning('Already copied test files to device %s, skipping.', 98 logging.warning('Already copied test files to device %s, skipping.',
102 self.device) 99 self.device)
103 return 100 return
104 101
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 duration_ms = 0 348 duration_ms = 0
352 message = str(e) 349 message = str(e)
353 if not message: 350 if not message:
354 message = 'No information.' 351 message = 'No information.'
355 results.AddResult(test_result.InstrumentationTestResult( 352 results.AddResult(test_result.InstrumentationTestResult(
356 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, 353 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms,
357 log=message)) 354 log=message))
358 raw_result = None 355 raw_result = None
359 self.TestTeardown(test, raw_result) 356 self.TestTeardown(test, raw_result)
360 return (results, None if results.DidRunPass() else test) 357 return (results, None if results.DidRunPass() else test)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698