Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: client/cros/login.py

Issue 6525034: Don't log chrome SIGABRT crashes during logout. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Code review fixes. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/cros/cros_ui_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cros/login.py
diff --git a/client/cros/login.py b/client/cros/login.py
index fa5a8ddadafd8e462d755aac6ade7cfc724196ef..60ad0371ca5a8c5921aa80ddd262c30863433b1c 100644
--- a/client/cros/login.py
+++ b/client/cros/login.py
@@ -11,6 +11,11 @@ from autotest_lib.client.common_lib import error
_DEFAULT_TIMEOUT = 30
+# Log messages used to signal when we're in a logout situation. Used to detect
+# crashes by cros_ui_test.UITest.
+LOGOUT_ATTEMPT_MSG = 'cros/login.py: Attempting logout...'
+LOGOUT_COMPLETE_MSG = 'cros/login.py: Logout complete.'
+
class TimeoutError(error.TestError):
"""Error raised when we time out while waiting on a condition."""
@@ -181,24 +186,31 @@ def attempt_logout(timeout=_DEFAULT_TIMEOUT):
if not logged_in():
raise UnexpectedCondition('Already logged out')
- oldpid = __get_session_manager_pid()
-
- # Mark /var/log/messages now; we'll run through all subsequent log messages
- # if we couldn't TERM and restart the session manager.
-
- log_reader = cros_logging.LogReader()
- log_reader.set_start_by_current()
-
- # Gracefully exiting the session manager causes the user's session to end.
- utils.system('pkill -TERM -o ^%s$' % constants.SESSION_MANAGER)
+ # Log what we're about to do to /var/log/messages. Used to log crashes later
+ # in cleanup by cros_ui_test.UITest.
+ utils.system('logger "%s"' % LOGOUT_ATTEMPT_MSG)
- wait_for_condition(
- condition=lambda: __session_manager_restarted(oldpid),
- timeout_msg='Timed out waiting for logout',
- timeout=timeout,
- process='session_manager',
- log_reader=log_reader,
- crash_msg='session_manager crashed while shutting down.')
+ try:
+ oldpid = __get_session_manager_pid()
+
+ # Mark /var/log/messages now; we'll run through all subsequent log
+ # messages if we couldn't TERM and restart the session manager.
+
+ log_reader = cros_logging.LogReader()
+ log_reader.set_start_by_current()
+
+ # Gracefully exiting the session manager causes the user's session to end.
+ utils.system('pkill -TERM -o ^%s$' % constants.SESSION_MANAGER)
+
+ wait_for_condition(
+ condition=lambda: __session_manager_restarted(oldpid),
+ timeout_msg='Timed out waiting for logout',
+ timeout=timeout,
+ process='session_manager',
+ log_reader=log_reader,
+ crash_msg='session_manager crashed while shutting down.')
+ finally:
+ utils.system('logger "%s"' % LOGOUT_COMPLETE_MSG)
def wait_for_browser(timeout=_DEFAULT_TIMEOUT):
« no previous file with comments | « client/cros/cros_ui_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698