OLD | NEW |
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2014 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 | 5 |
6 """Utility script to launch browser-tests on the Chromoting bot.""" | 6 """Utility script to launch browser-tests on the Chromoting bot.""" |
7 import argparse | 7 import argparse |
8 import glob | 8 import glob |
9 import hashlib | 9 import hashlib |
10 import os | 10 import os |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 for line in f: | 157 for line in f: |
158 # Reset the user profile directory to start each test with a clean slate. | 158 # Reset the user profile directory to start each test with a clean slate. |
159 SetupUserProfileDir(args.me2me_manifest_file, args.it2me_manifest_file, | 159 SetupUserProfileDir(args.me2me_manifest_file, args.it2me_manifest_file, |
160 args.user_profile_dir) | 160 args.user_profile_dir) |
161 | 161 |
162 # Replace the PROD_DIR value in the command-line with | 162 # Replace the PROD_DIR value in the command-line with |
163 # the passed in value. | 163 # the passed in value. |
164 line = line.replace(PROD_DIR_ID, args.prod_dir) | 164 line = line.replace(PROD_DIR_ID, args.prod_dir) |
165 LaunchBTCommand(line) | 165 LaunchBTCommand(line) |
166 | 166 |
| 167 # All tests completed. Include host-logs in the test results. |
| 168 host_log_contents = '' |
| 169 # There should be only 1 log file, as we delete logs on test completion. |
| 170 # Loop through matching files, just in case there are more. |
| 171 for log_file in glob.glob('/tmp/chrome_remote_desktop_*'): |
| 172 with open(log_file, 'r') as log: |
| 173 host_log_contents += '\nHOST LOG %s\n CONTENTS:\n%s' % ( |
| 174 log_file, log.read()) |
| 175 print host_log_contents |
| 176 |
167 # Was there any test failure? | 177 # Was there any test failure? |
168 if TEST_FAILURE: | 178 if TEST_FAILURE: |
169 # Obtain contents of Chromoting host logs. | |
170 log_contents = '' | |
171 # There should be only 1 log file, as we delete logs on test completion. | |
172 # Loop through matching files, just in case there are more. | |
173 for log_file in glob.glob('/tmp/chrome_remote_desktop_*'): | |
174 with open(log_file, 'r') as log: | |
175 log_contents += '\nHOST LOG %s\n CONTENTS:\n%s' % (log_file, log.read()) | |
176 print log_contents | |
177 raise Exception('At least one test failed.') | 179 raise Exception('At least one test failed.') |
178 | 180 |
179 # Now, stop host, and cleanup user-profile-dir | 181 # Now, stop host, and cleanup user-profile-dir |
180 TestCleanUp(args.user_profile_dir) | 182 TestCleanUp(args.user_profile_dir) |
181 | 183 |
182 if __name__ == '__main__': | 184 if __name__ == '__main__': |
183 main() | 185 main() |
OLD | NEW |