| 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_log_reader, \ | 6 from autotest_lib.client.bin import site_crash_test, site_log_reader, \ |
| 7 site_utils, test | 7 site_utils, test |
| 8 from autotest_lib.client.common_lib import error, utils | 8 from autotest_lib.client.common_lib import error, utils |
| 9 | 9 |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 raise error.TestFail('%s was not properly cleared' % _KCRASH_FILE) | 62 raise error.TestFail('%s was not properly cleared' % _KCRASH_FILE) |
| 63 | 63 |
| 64 | 64 |
| 65 def _test_sender_send_kcrash(self): | 65 def _test_sender_send_kcrash(self): |
| 66 """Test that crash_sender properly sends the crash report.""" | 66 """Test that crash_sender properly sends the crash report.""" |
| 67 if not self._consent: | 67 if not self._consent: |
| 68 return | 68 return |
| 69 kcrash_report = self._get_kcrash_name() | 69 kcrash_report = self._get_kcrash_name() |
| 70 if not os.path.exists(kcrash_report): | 70 if not os.path.exists(kcrash_report): |
| 71 raise error.TestFail('Crash report gone') | 71 raise error.TestFail('Crash report gone') |
| 72 self._set_sending(True) | |
| 73 result = self._call_sender_one_crash( | 72 result = self._call_sender_one_crash( |
| 74 report=os.path.basename(kcrash_report)) | 73 report=os.path.basename(kcrash_report)) |
| 75 if (not result['send_attempt'] or not result['send_success'] or | 74 if (not result['send_attempt'] or not result['send_success'] or |
| 76 result['report_exists']): | 75 result['report_exists']): |
| 77 raise error.TestFail('kcrash not sent properly') | 76 raise error.TestFail('kcrash not sent properly') |
| 78 if result['exec_name'] != 'kernel' or result['report_kind'] != 'kcrash': | 77 if result['exec_name'] != 'kernel' or result['report_kind'] != 'kcrash': |
| 79 raise error.TestFail('kcrash exec name or report kind wrong') | 78 raise error.TestFail('kcrash exec name or report kind wrong') |
| 80 if result['report_payload'] != kcrash_report: | 79 if result['report_payload'] != kcrash_report: |
| 81 raise error.TestFail('Sent the wrong kcrash report') | 80 raise error.TestFail('Sent the wrong kcrash report') |
| 82 | 81 |
| 83 | 82 |
| 84 def run_once(self, is_before, consent): | 83 def run_once(self, is_before, consent): |
| 85 self._log_reader.set_start_by_reboot(-1) | 84 self._log_reader.set_start_by_reboot(-1) |
| 86 # We manage consent saving across tests. | 85 # We manage consent saving across tests. |
| 87 self._automatic_consent_saving = False | 86 self._automatic_consent_saving = False |
| 88 self._consent = consent | 87 self._consent = consent |
| 89 if is_before: | 88 if is_before: |
| 90 self.run_crash_tests(['reporter_startup'], must_run_all=False) | 89 self.run_crash_tests(['reporter_startup'], must_run_all=False) |
| 91 # Leave crash sending paused for the kernel crash. | 90 # Leave crash sending paused for the kernel crash. |
| 92 self._leave_crash_sending = False | 91 self._leave_crash_sending = False |
| 93 else: | 92 else: |
| 94 self.run_crash_tests(['reporter_startup', | 93 self.run_crash_tests(['reporter_startup', |
| 95 'reporter_kcrash_storage', | 94 'reporter_kcrash_storage', |
| 96 'sender_send_kcrash'], | 95 'sender_send_kcrash'], |
| 97 clear_spool_first=False) | 96 clear_spool_first=False) |
| OLD | NEW |