blob: 05230e2a62230a26e04cf349eda60c07d8c2b1d6 [file] [log] [blame]
# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import dbus, logging, os, time
from autotest_lib.client.bin import test, utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.cros import constants, cros_logging, cryptohome, login
class platform_SessionManagerTerm(test.test):
version = 1
_testuser = ''
_testpass = 'testme'
def initialize(self):
cryptohome.mount_vault(self._testuser, self._testpass, create=True)
super(platform_SessionManagerTerm, self).initialize()
def run_once(self):
log_reader = cros_logging.LogReader()
binary = constants.SESSION_MANAGER
# Try to kill all running instances of the binary.
utils.system('pkill -TERM %s' % binary)
except error.CmdError, e:
raise error.TestFail('%s is not running before kill' % binary)
# Check if the binary is running again (using os.system(), since it
# doesn't raise an exception if the command fails).
lambda: os.system('pgrep %s >/dev/null' % binary) == 0,
error.TestFail('%s is probably not running after TERM' % binary),
# Assuming the process came back, did it exit appropriately?
if not log_reader.can_find('SessionManagerService exiting'):
error.TestFail('%s did not exit cleanly' % binary)
def cleanup(self):
super(platform_SessionManagerTerm, self).cleanup()