| Index: client/site_tests/desktopui_KillRestart/desktopui_KillRestart.py
|
| diff --git a/client/site_tests/desktopui_KillRestart/desktopui_KillRestart.py b/client/site_tests/desktopui_KillRestart/desktopui_KillRestart.py
|
| index 1b2b3e589cb9197fd2312a5a8e58249b0d09ac7a..d32b18e331b2a1f6b8b2b47aa32b63f7a8c3ecf1 100644
|
| --- a/client/site_tests/desktopui_KillRestart/desktopui_KillRestart.py
|
| +++ b/client/site_tests/desktopui_KillRestart/desktopui_KillRestart.py
|
| @@ -2,8 +2,8 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| -import logging, time, utils
|
| -from autotest_lib.client.bin import test
|
| +import logging, os, time, utils
|
| +from autotest_lib.client.bin import site_utils, test
|
| from autotest_lib.client.common_lib import error
|
|
|
| class desktopui_KillRestart(test.test):
|
| @@ -17,12 +17,8 @@ class desktopui_KillRestart(test.test):
|
| logging.debug(e)
|
| raise error.TestFail('%s is not running before kill' % binary)
|
|
|
| - # Give the system a chance to restart the binary.
|
| - time.sleep(3)
|
| -
|
| - # Check if the binary is running again.
|
| - try:
|
| - utils.system('pgrep %s' % binary)
|
| - except error.CmdError, e:
|
| - logging.debug(e)
|
| - raise error.TestFail('%s is not running after kill' % binary)
|
| + # Check if the binary is running again (using os.system(), since it
|
| + # doesn't raise an exception if the command fails).
|
| + site_utils.poll_for_condition(
|
| + lambda: os.system('pgrep %s' % binary) == 0,
|
| + error.TestFail('%s is not running after kill' % binary))
|
|
|