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_log_reader, site_utils, test | 6 from autotest_lib.client.bin import site_log_reader, 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 | 9 |
10 class CrashTest(test.test): | 10 class CrashTest(test.test): |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 output: output from the script | 142 output: output from the script |
143 | 143 |
144 Returns: | 144 Returns: |
145 A dictionary with these values: | 145 A dictionary with these values: |
146 exec_name: name of executable which crashed | 146 exec_name: name of executable which crashed |
147 meta_path: path to the report metadata file | 147 meta_path: path to the report metadata file |
148 output: the output from the script, copied | 148 output: the output from the script, copied |
149 report_kind: kind of report sent (minidump vs kernel) | 149 report_kind: kind of report sent (minidump vs kernel) |
150 send_attempt: did the script attempt to send a crash. | 150 send_attempt: did the script attempt to send a crash. |
151 send_success: if it attempted, was the crash send successful. | 151 send_success: if it attempted, was the crash send successful. |
| 152 sig: signature of the report, if given. |
152 sleep_time: if it attempted, how long did it sleep before | 153 sleep_time: if it attempted, how long did it sleep before |
153 sending (if mocked, how long would it have slept) | 154 sending (if mocked, how long would it have slept) |
154 """ | 155 """ |
155 sleep_match = re.search('Scheduled to send in (\d+)s', output) | 156 sleep_match = re.search('Scheduled to send in (\d+)s', output) |
156 send_attempt = sleep_match is not None | 157 send_attempt = sleep_match is not None |
157 if send_attempt: | 158 if send_attempt: |
158 sleep_time = int(sleep_match.group(1)) | 159 sleep_time = int(sleep_match.group(1)) |
159 else: | 160 else: |
160 sleep_time = None | 161 sleep_time = None |
161 meta_match = re.search('Metadata: (\S+) \((\S+)\)', output) | 162 meta_match = re.search('Metadata: (\S+) \((\S+)\)', output) |
162 if meta_match: | 163 if meta_match: |
163 meta_path = meta_match.group(1) | 164 meta_path = meta_match.group(1) |
164 report_kind = meta_match.group(2) | 165 report_kind = meta_match.group(2) |
165 else: | 166 else: |
166 meta_path = None | 167 meta_path = None |
167 report_kind = None | 168 report_kind = None |
168 payload_match = re.search('Payload: (\S+)', output) | 169 payload_match = re.search('Payload: (\S+)', output) |
169 if payload_match: | 170 if payload_match: |
170 report_payload = payload_match.group(1) | 171 report_payload = payload_match.group(1) |
171 else: | 172 else: |
172 report_payload = None | 173 report_payload = None |
173 exec_name_match = re.search('Exec name: (\S+)', output) | 174 exec_name_match = re.search('Exec name: (\S+)', output) |
174 if exec_name_match: | 175 if exec_name_match: |
175 exec_name = exec_name_match.group(1) | 176 exec_name = exec_name_match.group(1) |
176 else: | 177 else: |
177 exec_name = None | 178 exec_name = None |
| 179 sig_match = re.search('Sig: (\S+)', output) |
| 180 if sig_match: |
| 181 sig = sig_match.group(1) |
| 182 else: |
| 183 sig = None |
178 send_success = 'Mocking successful send' in output | 184 send_success = 'Mocking successful send' in output |
179 return {'exec_name': exec_name, | 185 return {'exec_name': exec_name, |
180 'report_kind': report_kind, | 186 'report_kind': report_kind, |
181 'meta_path': meta_path, | 187 'meta_path': meta_path, |
182 'report_payload': report_payload, | 188 'report_payload': report_payload, |
183 'send_attempt': send_attempt, | 189 'send_attempt': send_attempt, |
184 'send_success': send_success, | 190 'send_success': send_success, |
| 191 'sig': sig, |
185 'sleep_time': sleep_time, | 192 'sleep_time': sleep_time, |
186 'output': output} | 193 'output': output} |
187 | 194 |
188 | 195 |
189 def wait_for_sender_completion(self): | 196 def wait_for_sender_completion(self): |
190 """Wait for crash_sender to complete. | 197 """Wait for crash_sender to complete. |
191 | 198 |
192 Wait for no crash_sender's last message to be placed in the | 199 Wait for no crash_sender's last message to be placed in the |
193 system log before continuing and for the process to finish. | 200 system log before continuing and for the process to finish. |
194 Otherwise we might get only part of the output.""" | 201 Otherwise we might get only part of the output.""" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 self._initialize_crash_reporter() | 320 self._initialize_crash_reporter() |
314 # Disable crash_sender from running, kill off any running ones, but | 321 # Disable crash_sender from running, kill off any running ones, but |
315 # set environment so crash_sender may run as a child process. | 322 # set environment so crash_sender may run as a child process. |
316 self._set_system_sending(False) | 323 self._set_system_sending(False) |
317 self._set_child_sending(True) | 324 self._set_child_sending(True) |
318 self._kill_running_sender() | 325 self._kill_running_sender() |
319 self._reset_rate_limiting() | 326 self._reset_rate_limiting() |
320 if clear_spool_first: | 327 if clear_spool_first: |
321 self._clear_spooled_crashes() | 328 self._clear_spooled_crashes() |
322 getattr(self, '_test_' + test_name)() | 329 getattr(self, '_test_' + test_name)() |
OLD | NEW |