OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS 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 import logging, os, re | 5 import logging, os, re |
6 from autotest_lib.client.bin import site_crash_test, site_utils, test | 6 from autotest_lib.client.bin import site_crash_test, site_utils, test |
7 from autotest_lib.client.common_lib import error, utils | 7 from autotest_lib.client.common_lib import error, utils |
8 | 8 |
9 _25_HOURS_AGO = -25 * 60 * 60 | 9 _25_HOURS_AGO = -25 * 60 * 60 |
10 _CRASH_SENDER_CRON_PATH = '/etc/cron.hourly/crash_sender.hourly' | 10 _CRASH_SENDER_CRON_PATH = '/etc/cron.hourly/crash_sender.hourly' |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 Assuming we've run test_sender_simple which shows that a minidump | 220 Assuming we've run test_sender_simple which shows that a minidump |
221 gets removed as part of sending, we run the cron job (which is | 221 gets removed as part of sending, we run the cron job (which is |
222 asynchronous) and wait for that file to be removed to just verify | 222 asynchronous) and wait for that file to be removed to just verify |
223 the job eventually runs the sender.""" | 223 the job eventually runs the sender.""" |
224 minidump = self._prepare_sender_one_crash(send_success=True, | 224 minidump = self._prepare_sender_one_crash(send_success=True, |
225 reports_enabled=True, | 225 reports_enabled=True, |
226 username='root', | 226 username='root', |
227 report=None) | 227 report=None) |
228 if not os.path.exists(minidump): | 228 if not os.path.exists(minidump): |
229 raise error.TestError('minidump not created') | 229 raise error.TestError('minidump not created') |
| 230 self._log_reader.set_start_by_current() |
230 utils.system(_CRASH_SENDER_CRON_PATH) | 231 utils.system(_CRASH_SENDER_CRON_PATH) |
231 self._log_reader.set_start_by_current() | 232 self.wait_for_sender_completion() |
232 site_utils.poll_for_condition( | 233 if os.path.exists(minidump): |
233 lambda: not os.path.exists(minidump), | 234 raise error.TestFail('minidump was not removed') |
234 desc='minidump to be removed') | |
235 crash_sender_log = self._log_reader.get_logs() | 235 crash_sender_log = self._log_reader.get_logs() |
236 logging.debug('Contents of crash sender log: ' + crash_sender_log) | 236 logging.debug('Contents of crash sender log: ' + crash_sender_log) |
237 result = self._parse_sender_output(crash_sender_log) | 237 result = self._parse_sender_output(crash_sender_log) |
| 238 logging.debug('Result of crash send: %s' % result) |
238 if not result['send_attempt'] or not result['send_success']: | 239 if not result['send_attempt'] or not result['send_success']: |
239 raise error.TestFail('Cron simple run test failed') | 240 raise error.TestFail('Cron simple run test failed') |
240 | 241 |
241 | 242 |
242 def run_once(self): | 243 def run_once(self): |
243 self.run_crash_tests([ | 244 self.run_crash_tests([ |
244 'sender_simple_minidump', | 245 'sender_simple_minidump', |
245 'sender_simple_old_minidump', | 246 'sender_simple_old_minidump', |
246 'sender_simple_kernel_crash', | 247 'sender_simple_kernel_crash', |
247 'sender_pausing', | 248 'sender_pausing', |
248 'sender_reports_disabled', | 249 'sender_reports_disabled', |
249 'sender_rate_limiting', | 250 'sender_rate_limiting', |
250 'sender_single_instance', | 251 'sender_single_instance', |
251 'sender_send_fails', | 252 'sender_send_fails', |
252 'sender_orphaned_files', | 253 'sender_orphaned_files', |
253 'sender_incomplete_metadata', | 254 'sender_incomplete_metadata', |
254 'cron_runs']) | 255 'cron_runs']) |
OLD | NEW |