Index: client/cros/login.py |
diff --git a/client/cros/login.py b/client/cros/login.py |
index c8b1f5023dfc75746d99a1d4f3fd870df6991656..e7c2e4278d1e4710c3a533f74a43813773cccafb 100644 |
--- a/client/cros/login.py |
+++ b/client/cros/login.py |
@@ -4,8 +4,8 @@ |
import errno, logging, os, re, signal, subprocess, time |
import common |
-import constants as chromeos_constants, cryptohome, ui |
-from autotest_lib.client.bin import test, utils, site_log_reader |
+import constants as chromeos_constants, cryptohome, log_reader, ui |
+from autotest_lib.client.bin import utils |
from autotest_lib.client.common_lib import error |
@@ -90,16 +90,16 @@ def logged_in(): |
return os.path.exists(chromeos_constants.LOGGED_IN_MAGIC_FILE) |
-def process_crashed(process, log_reader): |
- """Checks the log watched by |log_reader| to see if a crash was reported |
+def process_crashed(process, logreader): |
kmixter1
2010/12/16 03:12:57
suggest renaming class and using the standard _ se
ericli
2010/12/17 21:48:39
With the new naming, now it makes more sense.
Done
|
+ """Checks the log watched by |logreader| to see if a crash was reported |
for |process|. |
Returns True if so, False if not. |
""" |
- return log_reader.can_find('Received crash notification for %s' % process) |
+ return logreader.can_find('Received crash notification for %s' % process) |
-def wait_for_condition(condition, timeout_msg, timeout, process, log_reader, |
+def wait_for_condition(condition, timeout_msg, timeout, process, logreader, |
crash_msg): |
try: |
utils.poll_for_condition( |
@@ -108,7 +108,7 @@ def wait_for_condition(condition, timeout_msg, timeout, process, log_reader, |
timeout=timeout) |
except TimeoutError, e: |
# We could fail faster if necessary, but it'd be more complicated. |
- if process_crashed(process, log_reader): |
+ if process_crashed(process, logreader): |
raise CrashError(crash_msg) |
else: |
raise e |
@@ -138,8 +138,8 @@ def attempt_login(username, password, timeout=_DEFAULT_TIMEOUT): |
# Mark /var/log/messages now; we'll run through all subsequent log messages |
# if we couldn't log in to see if the browser crashed. |
- log_reader = site_log_reader.LogReader() |
- log_reader.set_start_by_current() |
+ my_log_reader = log_reader.LogReader() |
+ my_log_reader.set_start_by_current() |
ax = ui.get_autox() |
# navigate to login screen |
@@ -164,7 +164,7 @@ def attempt_login(username, password, timeout=_DEFAULT_TIMEOUT): |
timeout_msg='Timed out waiting for login', |
timeout=timeout, |
process='chrome', |
- log_reader=log_reader, |
+ logreader=my_log_reader, |
crash_msg='Chrome crashed during login') |
@@ -185,8 +185,8 @@ def attempt_logout(timeout=_DEFAULT_TIMEOUT): |
# 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 = site_log_reader.LogReader() |
- log_reader.set_start_by_current() |
+ my_log_reader = log_reader.LogReader() |
+ my_log_reader.set_start_by_current() |
# Gracefully exiting the session manager causes the user's session to end. |
utils.system('pkill -TERM -o ^%s$' % chromeos_constants.SESSION_MANAGER) |
@@ -196,7 +196,7 @@ def attempt_logout(timeout=_DEFAULT_TIMEOUT): |
timeout_msg='Timed out waiting for logout', |
timeout=timeout, |
process='session_manager', |
- log_reader=log_reader, |
+ logreader=my_log_reader, |
crash_msg='session_manager crashed while shutting down.') |
@@ -211,14 +211,14 @@ def wait_for_browser(timeout=_DEFAULT_TIMEOUT): |
""" |
# Mark /var/log/messages now; we'll run through all subsequent log messages |
# if we couldn't start chrome to see if the browser crashed. |
- log_reader = site_log_reader.LogReader() |
- log_reader.set_start_by_current() |
+ my_log_reader = log_reader.LogReader() |
+ my_log_reader.set_start_by_current() |
wait_for_condition( |
lambda: os.system('pgrep ^%s$' % chromeos_constants.BROWSER) == 0, |
timeout_msg='Timed out waiting for Chrome to start', |
timeout=timeout, |
process='chrome', |
- log_reader=log_reader, |
+ logreader=my_log_reader, |
crash_msg='Chrome crashed while starting up.') |
@@ -233,14 +233,14 @@ def wait_for_cryptohome(timeout=_DEFAULT_TIMEOUT): |
""" |
# Mark /var/log/messages now; we'll run through all subsequent log messages |
# if we couldn't get the browser up to see if the browser crashed. |
- log_reader = site_log_reader.LogReader() |
- log_reader.set_start_by_current() |
+ my_log_reader = log_reader.LogReader() |
+ my_log_reader.set_start_by_current() |
wait_for_condition( |
condition=lambda: cryptohome.is_mounted(), |
timeout_msg='Timed out waiting for cryptohome to be mounted', |
timeout=timeout, |
process='cryptohomed', |
- log_reader=log_reader, |
+ logreader=my_log_reader, |
crash_msg='cryptohomed crashed during mount attempt') |
@@ -255,15 +255,15 @@ def wait_for_login_prompt(timeout=_DEFAULT_TIMEOUT): |
""" |
# Mark /var/log/messages now; we'll run through all subsequent log messages |
# if we couldn't get the browser up to see if the browser crashed. |
- log_reader = site_log_reader.LogReader() |
- log_reader.set_start_by_current() |
+ my_log_reader = log_reader.LogReader() |
+ my_log_reader.set_start_by_current() |
wait_for_condition( |
condition=lambda: os.access( |
chromeos_constants.LOGIN_PROMPT_READY_MAGIC_FILE, os.F_OK), |
timeout_msg='Timed out waiting for login prompt', |
timeout=timeout, |
process='chrome', |
- log_reader=log_reader, |
+ logreader=my_log_reader, |
crash_msg='Chrome crashed before the login prompt.') |
@@ -293,15 +293,15 @@ def wait_for_initial_chrome_window(timeout=_DEFAULT_TIMEOUT): |
""" |
# Mark /var/log/messages now; we'll run through all subsequent log messages |
# if we couldn't get the browser up to see if the browser crashed. |
- log_reader = site_log_reader.LogReader() |
- log_reader.set_start_by_current() |
+ my_log_reader = log_reader.LogReader() |
+ my_log_reader.set_start_by_current() |
wait_for_condition( |
lambda: os.access( |
chromeos_constants.CHROME_WINDOW_MAPPED_MAGIC_FILE, os.F_OK), |
'Timed out waiting for initial Chrome window', |
timeout=timeout, |
process='chrome', |
- log_reader=log_reader, |
+ logreader=my_log_reader, |
crash_msg='Chrome crashed before first tab rendered.') |