summaryrefslogtreecommitdiffstats
path: root/chrome/test/chromeos/autotest
diff options
context:
space:
mode:
authornirnimesh@google.com <nirnimesh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 21:27:48 +0000
committernirnimesh@google.com <nirnimesh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 21:27:48 +0000
commitaa06595d090165c9b41f936424629e55b3063a6a (patch)
tree90bd5cf9fa779deceb009e3904530796ecad4827 /chrome/test/chromeos/autotest
parenta0148f28664af0b11dc3cfe7a240d276aa762730 (diff)
downloadchromium_src-aa06595d090165c9b41f936424629e55b3063a6a.zip
chromium_src-aa06595d090165c9b41f936424629e55b3063a6a.tar.gz
chromium_src-aa06595d090165c9b41f936424629e55b3063a6a.tar.bz2
Fix pyauto launcher for chromeos
PyAuto login automation is broken such that it crashes the browser in cases where the ownership is not taken and you don't wait long enough for chrome to startup, login dialog to show, etc. It takes time for chrome to sink these in. For this reason pyauto tests on autotest lab machines were failing (the autotest lab machines begin with a clean stateful partition, and then we trigger a session_manager restart after creating enable_chromium_minidumps file) This CL fixes the launcher. The Login() automation still needs to be fixed to be resilient to the login dialog to show up. BUG=15582 TEST=pyauto test fire up on chromeos autotest lab machines Review URL: http://codereview.chromium.org/7065016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86493 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chromeos/autotest')
-rw-r--r--chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py49
1 files changed, 18 insertions, 31 deletions
diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
index f6d4a37..46acc63 100644
--- a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
+++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_PyAutoFunctionalTests/desktopui_PyAutoFunctionalTests.py
@@ -9,7 +9,7 @@ import shutil
import subprocess
from autotest_lib.client.bin import utils
-from autotest_lib.client.cros import constants, chrome_test, cros_ui
+from autotest_lib.client.cros import constants, chrome_test, cros_ui, login
class desktopui_PyAutoFunctionalTests(chrome_test.ChromeTestBase):
@@ -26,10 +26,6 @@ class desktopui_PyAutoFunctionalTests(chrome_test.ChromeTestBase):
deps_dir = os.path.join(self.autodir, 'deps')
subprocess.check_call(['chown', '-R', 'chronos', self.cr_source_dir])
- # Setup /tmp/disable_chrome_restart
- if not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
- open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
-
# Setup suid python binary which can enable chrome testing interface
suid_python = os.path.join(self.test_binary_dir, 'suid-python')
py_path = subprocess.Popen(['which', 'python'],
@@ -43,35 +39,28 @@ class desktopui_PyAutoFunctionalTests(chrome_test.ChromeTestBase):
os.chown(suid_python, 0, 0)
os.chmod(suid_python, 04755)
- def _session_manager_ready(self, old_pid):
- pgrep_process = subprocess.Popen(["pgrep", "session_manager"],
- stdout=subprocess.PIPE)
- new_pid = pgrep_process.communicate()[0].strip()
- if not new_pid or old_pid == new_pid:
- return False
-
- try:
- bus = dbus.SystemBus()
- proxy = bus.get_object('org.chromium.SessionManager',
- '/org/chromium/SessionManager')
- dbus.Interface(proxy, 'org.chromium.SessionManagerInterface')
- except dbus.DBusException:
- return False
- return True
+ # chronos should own the current dir
+ chronos_id = pwd.getpwnam('chronos')
+ os.chown(os.getcwd(), chronos_id.pw_uid, chronos_id.pw_gid)
- def run_once(self):
- # Make sure Chrome minidumps are written locally.
+ # Make sure Chrome minidumps are written locally
minidumps_file = '/mnt/stateful_partition/etc/enable_chromium_minidumps'
if not os.path.exists(minidumps_file):
open(minidumps_file, 'w').close()
- pgrep_process = subprocess.Popen(["pgrep", "session_manager"],
- stdout=subprocess.PIPE)
- old_pid = pgrep_process.communicate()[0].strip()
- subprocess.call(['pkill', constants.SESSION_MANAGER])
- utils.poll_for_condition(
- lambda: self._session_manager_ready(old_pid), timeout=20)
+ # Allow browser restart by its babysitter (session_manager)
+ if os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
+ os.remove(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
+ login.nuke_login_manager()
assert os.path.exists(minidumps_file)
+ # Setup /tmp/disable_chrome_restart
+ # Disallow further browser restart by its babysitter
+ if not os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE):
+ open(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE, 'w').close()
+ assert os.path.exists(constants.DISABLE_BROWSER_RESTART_MAGIC_FILE)
+
+ def run_once(self):
+ """Run pyauto functional tests."""
# Enable chrome testing interface and Login
deps_dir = os.path.join(self.autodir, 'deps')
pyautolib_dir = os.path.join(self.cr_source_dir,
@@ -82,9 +71,7 @@ class desktopui_PyAutoFunctionalTests(chrome_test.ChromeTestBase):
os.path.join(pyautolib_dir, 'chromeos', 'chromeos_utils.py'))
utils.system(login_cmd)
- # Run pyauto tests in the "FULL" suite
- chronos_id = pwd.getpwnam('chronos')
- os.chown(os.getcwd(), chronos_id.pw_uid, chronos_id.pw_gid)
+ # Run pyauto tests "FULL" suite
functional_cmd = cros_ui.xcommand_as(
'%s/chrome_test/test_src/chrome/test/functional/'
'pyauto_functional.py --suite=FULL -v' % deps_dir)