| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 def GetAllTests(self, device): | 116 def GetAllTests(self, device): |
| 117 all_tests = device.RunShellCommand( | 117 all_tests = device.RunShellCommand( |
| 118 '%s %s/%s --gtest_list_tests' % | 118 '%s %s/%s --gtest_list_tests' % |
| 119 (self.tool.GetTestWrapper(), | 119 (self.tool.GetTestWrapper(), |
| 120 constants.TEST_EXECUTABLE_DIR, | 120 constants.TEST_EXECUTABLE_DIR, |
| 121 self.suite_name)) | 121 self.suite_name)) |
| 122 return self._ParseGTestListTests(all_tests) | 122 return self._ParseGTestListTests(all_tests) |
| 123 | 123 |
| 124 #override | 124 #override |
| 125 def SpawnTestProcess(self, device): | 125 def SpawnTestProcess(self, device): |
| 126 args = ['adb', '-s', device.old_interface.GetDevice(), 'shell', 'sh', | 126 args = ['adb', '-s', str(device), 'shell', 'sh', |
| 127 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] | 127 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] |
| 128 logging.info(args) | 128 logging.info(args) |
| 129 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) | 129 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) |
| 130 | 130 |
| 131 #override | 131 #override |
| 132 def Install(self, device): | 132 def Install(self, device): |
| 133 if self.tool.NeedsDebugInfo(): | 133 if self.tool.NeedsDebugInfo(): |
| 134 target_name = self.suite_path | 134 target_name = self.suite_path |
| 135 else: | 135 else: |
| 136 target_name = self.suite_path + '_stripped' | 136 target_name = self.suite_path + '_stripped' |
| 137 if not os.path.isfile(target_name): | 137 if not os.path.isfile(target_name): |
| 138 raise Exception('Did not find %s, build target %s' % | 138 raise Exception('Did not find %s, build target %s' % |
| 139 (target_name, self.suite_name + '_stripped')) | 139 (target_name, self.suite_name + '_stripped')) |
| 140 | 140 |
| 141 target_mtime = os.stat(target_name).st_mtime | 141 target_mtime = os.stat(target_name).st_mtime |
| 142 source_mtime = os.stat(self.suite_path).st_mtime | 142 source_mtime = os.stat(self.suite_path).st_mtime |
| 143 if target_mtime < source_mtime: | 143 if target_mtime < source_mtime: |
| 144 raise Exception( | 144 raise Exception( |
| 145 'stripped binary (%s, timestamp %d) older than ' | 145 'stripped binary (%s, timestamp %d) older than ' |
| 146 'source binary (%s, timestamp %d), build target %s' % | 146 'source binary (%s, timestamp %d), build target %s' % |
| 147 (target_name, target_mtime, self.suite_path, source_mtime, | 147 (target_name, target_mtime, self.suite_path, source_mtime, |
| 148 self.suite_name + '_stripped')) | 148 self.suite_name + '_stripped')) |
| 149 | 149 |
| 150 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 150 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
| 151 device.PushChangedFiles(target_name, test_binary) | 151 device.PushChangedFiles(target_name, test_binary) |
| OLD | NEW |