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 shutil | 9 import shutil |
10 import sys | 10 import sys |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 args = ['adb', '-s', adb.GetDevice(), 'shell', 'sh', | 115 args = ['adb', '-s', adb.GetDevice(), 'shell', 'sh', |
116 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] | 116 constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh'] |
117 logging.info(args) | 117 logging.info(args) |
118 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) | 118 return pexpect.spawn(args[0], args[1:], logfile=sys.stdout) |
119 | 119 |
120 #override | 120 #override |
121 def Install(self, adb): | 121 def Install(self, adb): |
122 if self.tool.NeedsDebugInfo(): | 122 if self.tool.NeedsDebugInfo(): |
123 target_name = self.suite_path | 123 target_name = self.suite_path |
124 else: | 124 else: |
125 target_name = self.suite_path + '_' + adb.GetDevice() + '_stripped' | 125 target_name = self.suite_path + '_stripped' |
126 should_strip = True | 126 if not os.path.isfile(target_name): |
127 if os.path.isfile(target_name): | 127 logging.critical('Did not find %s, build target %s', |
128 logging.info('Found target file %s' % target_name) | 128 target_name, self.suite_name + '_stripped') |
129 target_mtime = os.stat(target_name).st_mtime | 129 sys.exit(1) |
130 source_mtime = os.stat(self.suite_path).st_mtime | |
131 if target_mtime > source_mtime: | |
132 logging.info('Target mtime (%d) is newer than source (%d), assuming ' | |
133 'no change.' % (target_mtime, source_mtime)) | |
134 should_strip = False | |
135 | 130 |
136 if should_strip: | 131 target_mtime = os.stat(target_name).st_mtime |
137 logging.info('Did not find up-to-date stripped binary. Generating a ' | 132 source_mtime = os.stat(self.suite_path).st_mtime |
138 'new one (%s).' % target_name) | 133 if target_mtime < source_mtime: |
139 # Whenever we generate a stripped binary, copy to the symbols dir. If we | 134 logging.critical( |
140 # aren't stripping a new binary, assume it's there. | 135 'stripped binary (%s, timestamp %d) older than ' |
141 if not os.path.exists(self._symbols_dir): | 136 'source binary (%s, timestamp %d), build target %s', |
142 os.makedirs(self._symbols_dir) | 137 target_name, target_mtime, self.suite_path, source_mtime, |
143 shutil.copy(self.suite_path, self._symbols_dir) | 138 self.suite_name + '_stripped') |
144 strip = os.environ['STRIP'] | 139 sys.exit(1) |
145 cmd_helper.RunCmd([strip, self.suite_path, '-o', target_name]) | 140 |
146 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name | 141 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name |
147 adb.PushIfNeeded(target_name, test_binary) | 142 adb.PushIfNeeded(target_name, test_binary) |
OLD | NEW |