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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 except KeyError: | 70 except KeyError: |
71 logging.info('NATIVE_COVERAGE_DEPTH_STRIP is not defined: ' | 71 logging.info('NATIVE_COVERAGE_DEPTH_STRIP is not defined: ' |
72 'No native coverage.') | 72 'No native coverage.') |
73 return '' | 73 return '' |
74 except device_errors.CommandFailedError: | 74 except device_errors.CommandFailedError: |
75 logging.info('No external storage found: No native coverage.') | 75 logging.info('No external storage found: No native coverage.') |
76 return '' | 76 return '' |
77 | 77 |
78 #override | 78 #override |
79 def ClearApplicationState(self, device): | 79 def ClearApplicationState(self, device): |
80 device.old_interface.KillAllBlocking(self.suite_name, 30) | 80 try: |
| 81 # We don't expect the executable to be running, so we don't attempt |
| 82 # to retry on failure. |
| 83 device.KillAll(self.suite_name, blocking=True, timeout=30, retries=0) |
| 84 except device_errors.CommandFailedError: |
| 85 # KillAll raises an exception if it can't find a process with the given |
| 86 # name. We only care that there is no process with the given name, so |
| 87 # we can safely eat the exception. |
| 88 pass |
81 | 89 |
82 #override | 90 #override |
83 def CreateCommandLineFileOnDevice(self, device, test_filter, test_arguments): | 91 def CreateCommandLineFileOnDevice(self, device, test_filter, test_arguments): |
84 tool_wrapper = self.tool.GetTestWrapper() | 92 tool_wrapper = self.tool.GetTestWrapper() |
85 sh_script_file = tempfile.NamedTemporaryFile() | 93 sh_script_file = tempfile.NamedTemporaryFile() |
86 # We need to capture the exit status from the script since adb shell won't | 94 # We need to capture the exit status from the script since adb shell won't |
87 # propagate to us. | 95 # propagate to us. |
88 sh_script_file.write('cd %s\n' | 96 sh_script_file.write('cd %s\n' |
89 '%s' | 97 '%s' |
90 '%s %s/%s --gtest_filter=%s %s\n' | 98 '%s %s/%s --gtest_filter=%s %s\n' |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 source_mtime = os.stat(self.suite_path).st_mtime | 142 source_mtime = os.stat(self.suite_path).st_mtime |
135 if target_mtime < source_mtime: | 143 if target_mtime < source_mtime: |
136 raise Exception( | 144 raise Exception( |
137 'stripped binary (%s, timestamp %d) older than ' | 145 'stripped binary (%s, timestamp %d) older than ' |
138 'source binary (%s, timestamp %d), build target %s' % | 146 'source binary (%s, timestamp %d), build target %s' % |
139 (target_name, target_mtime, self.suite_path, source_mtime, | 147 (target_name, target_mtime, self.suite_path, source_mtime, |
140 self.suite_name + '_stripped')) | 148 self.suite_name + '_stripped')) |
141 | 149 |
142 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 150 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
143 device.old_interface.PushIfNeeded(target_name, test_binary) | 151 device.old_interface.PushIfNeeded(target_name, test_binary) |
OLD | NEW |