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 dbus, logging, os, re, shutil, socket, sys, time | 5 import dbus, logging, os, re, shutil, socket, sys, time |
6 import common | 6 import common |
7 import auth_server, constants as chromeos_constants, cryptohome, dns_server | 7 import auth_server, constants as chromeos_constants, cryptohome, dns_server |
8 import cros_logging, cros_ui, login | 8 import cros_logging, cros_ui, login |
9 from autotest_lib.client.bin import test, utils | 9 from autotest_lib.client.bin import test, utils |
10 from autotest_lib.client.common_lib import error | 10 from autotest_lib.client.common_lib import error |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 method as well. | 283 method as well. |
284 """ | 284 """ |
285 if hasattr(self, '_authServer'): | 285 if hasattr(self, '_authServer'): |
286 self.revert_dns() | 286 self.revert_dns() |
287 self._authServer.stop() | 287 self._authServer.stop() |
288 self._dnsServer.stop() | 288 self._dnsServer.stop() |
289 | 289 |
290 | 290 |
291 def __log_crashed_processes(self, processes): | 291 def __log_crashed_processes(self, processes): |
292 """Runs through the log watched by |watcher| to see if a crash was | 292 """Runs through the log watched by |watcher| to see if a crash was |
293 reported for any process names listed in |processes|. | 293 reported for any process names listed in |processes|. SIGABRT crashes in |
294 chrome during logout are ignored. | |
294 """ | 295 """ |
295 regex = re.compile(r'Received crash notification for (\w+).+ (sig \d+)', | 296 logout_start_regex = re.compile(login.LOGOUT_ATTEMPT_MSG) |
DaleCurtis
2011/02/15 23:45:43
I realize there's a regular expression that can do
| |
296 re.MULTILINE) | 297 crash_regex = re.compile( |
297 for match in regex.finditer(self._log_reader.get_logs()): | 298 'Received crash notification for (\w+).+ (sig \d+)') |
298 if match.group(1) not in processes: | 299 logout_complete_regex = re.compile(login.LOGOUT_COMPLETE_MSG) |
299 self.job.record('INFO', self.tagged_testname, | 300 |
300 "%s crash" % match.group(1), match.group(2)) | 301 in_logout = False |
302 for line in self._log_reader.get_logs().split('\n'): | |
303 if logout_start_regex.search(line): | |
304 in_logout = True | |
305 elif logout_complete_regex.search(line): | |
306 in_logout = False | |
307 else: | |
308 match = crash_regex.search(line) | |
309 if (match and not match.group(1) in processes and | |
310 not (in_logout and match.group(1) == 'chrome' and | |
Chris Masone
2011/02/16 00:38:32
can you use constants.BROWSER instead of 'chrome'?
DaleCurtis
2011/02/16 01:20:08
Done.
| |
311 match.group(2) == 'sig 6')): | |
312 self.job.record('INFO', self.tagged_testname, | |
313 line[match.start():]) | |
301 | 314 |
302 | 315 |
303 def cleanup(self): | 316 def cleanup(self): |
304 """Overridden from test.cleanup() to log out when the test is complete. | 317 """Overridden from test.cleanup() to log out when the test is complete. |
305 """ | 318 """ |
306 logpath = chromeos_constants.CHROME_LOG_DIR | 319 logpath = chromeos_constants.CHROME_LOG_DIR |
307 | 320 |
308 try: | 321 try: |
309 for file in os.listdir(logpath): | 322 for file in os.listdir(logpath): |
310 fullpath = os.path.join(logpath, file) | 323 fullpath = os.path.join(logpath, file) |
(...skipping 23 matching lines...) Expand all Loading... | |
334 | 347 |
335 self.stop_authserver() | 348 self.stop_authserver() |
336 self.__log_crashed_processes(self.crash_blacklist) | 349 self.__log_crashed_processes(self.crash_blacklist) |
337 | 350 |
338 | 351 |
339 def get_auth_endpoint_misses(self): | 352 def get_auth_endpoint_misses(self): |
340 if hasattr(self, '_authServer'): | 353 if hasattr(self, '_authServer'): |
341 return self._authServer.get_endpoint_misses() | 354 return self._authServer.get_endpoint_misses() |
342 else: | 355 else: |
343 return {} | 356 return {} |
OLD | NEW |