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 logging.info(args) | 116 logging.info(args) |
117 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) | 117 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) |
118 | 118 |
119 #override | 119 #override |
120 def Install(self, adb): | 120 def Install(self, adb): |
121 if self.tool.NeedsDebugInfo(): | 121 if self.tool.NeedsDebugInfo(): |
122 target_name = self.suite_path | 122 target_name = self.suite_path |
123 else: | 123 else: |
124 target_name = self.suite_path + '_stripped' | 124 target_name = self.suite_path + '_stripped' |
125 if not os.path.isfile(target_name): | 125 if not os.path.isfile(target_name): |
126 logging.critical('Did not find %s, build target %s', | 126 raise Exception('Did not find %s, build target %s' % |
127 target_name, self.suite_name + '_stripped') | 127 (target_name, self.suite_name + '_stripped')) |
128 sys.exit(1) | |
129 | 128 |
130 target_mtime = os.stat(target_name).st_mtime | 129 target_mtime = os.stat(target_name).st_mtime |
131 source_mtime = os.stat(self.suite_path).st_mtime | 130 source_mtime = os.stat(self.suite_path).st_mtime |
132 if target_mtime < source_mtime: | 131 if target_mtime < source_mtime: |
133 logging.critical( | 132 raise Exception( |
134 'stripped binary (%s, timestamp %d) older than ' | 133 'stripped binary (%s, timestamp %d) older than ' |
135 'source binary (%s, timestamp %d), build target %s', | 134 'source binary (%s, timestamp %d), build target %s' % |
136 target_name, target_mtime, self.suite_path, source_mtime, | 135 (target_name, target_mtime, self.suite_path, source_mtime, |
137 self.suite_name + '_stripped') | 136 self.suite_name + '_stripped')) |
138 sys.exit(1) | |
139 | 137 |
140 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 138 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
141 adb.PushIfNeeded(target_name, test_binary) | 139 adb.PushIfNeeded(target_name, test_binary) |
OLD | NEW |