OLD | NEW |
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 """Defines TestPackageExecutable to help run stand-alone executables.""" | 5 """Defines TestPackageExecutable to help run stand-alone executables.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 import tempfile | 10 import tempfile |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 except KeyError: | 71 except KeyError: |
72 logging.info('NATIVE_COVERAGE_DEPTH_STRIP is not defined: ' | 72 logging.info('NATIVE_COVERAGE_DEPTH_STRIP is not defined: ' |
73 'No native coverage.') | 73 'No native coverage.') |
74 return '' | 74 return '' |
75 except device_errors.CommandFailedError: | 75 except device_errors.CommandFailedError: |
76 logging.info('No external storage found: No native coverage.') | 76 logging.info('No external storage found: No native coverage.') |
77 return '' | 77 return '' |
78 | 78 |
79 #override | 79 #override |
80 def ClearApplicationState(self, device): | 80 def ClearApplicationState(self, device): |
81 try: | 81 device.KillAll(self.suite_name, blocking=True, timeout=30, quiet=True) |
82 # We don't expect the executable to be running, so we don't attempt | |
83 # to retry on failure. | |
84 device.KillAll(self.suite_name, blocking=True, timeout=30, retries=0) | |
85 except device_errors.CommandFailedError: | |
86 # KillAll raises an exception if it can't find a process with the given | |
87 # name. We only care that there is no process with the given name, so | |
88 # we can safely eat the exception. | |
89 pass | |
90 | 82 |
91 #override | 83 #override |
92 def CreateCommandLineFileOnDevice(self, device, test_filter, test_arguments): | 84 def CreateCommandLineFileOnDevice(self, device, test_filter, test_arguments): |
93 tool_wrapper = self.tool.GetTestWrapper() | 85 tool_wrapper = self.tool.GetTestWrapper() |
94 sh_script_file = tempfile.NamedTemporaryFile() | 86 sh_script_file = tempfile.NamedTemporaryFile() |
95 # We need to capture the exit status from the script since adb shell won't | 87 # We need to capture the exit status from the script since adb shell won't |
96 # propagate to us. | 88 # propagate to us. |
97 sh_script_file.write( | 89 sh_script_file.write( |
98 'cd %s\n' | 90 'cd %s\n' |
99 '%s' | 91 '%s' |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 'stripped binary (%s, timestamp %d) older than ' | 145 'stripped binary (%s, timestamp %d) older than ' |
154 'source binary (%s, timestamp %d), build target %s' % | 146 'source binary (%s, timestamp %d), build target %s' % |
155 (target_name, target_mtime, self.suite_path, source_mtime, | 147 (target_name, target_mtime, self.suite_path, source_mtime, |
156 self.suite_name + '_stripped')) | 148 self.suite_name + '_stripped')) |
157 | 149 |
158 test_binary_path = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 150 test_binary_path = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
159 device.PushChangedFiles([(target_name, test_binary_path)]) | 151 device.PushChangedFiles([(target_name, test_binary_path)]) |
160 deps_path = self.suite_path + '_deps' | 152 deps_path = self.suite_path + '_deps' |
161 if os.path.isdir(deps_path): | 153 if os.path.isdir(deps_path): |
162 device.PushChangedFiles([(deps_path, test_binary_path + '_deps')]) | 154 device.PushChangedFiles([(deps_path, test_binary_path + '_deps')]) |
OLD | NEW |