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

Unified Diff: client/site_tests/desktopui_KillRestart/desktopui_KillRestart.py

Issue 1565001: test: Clean up site_login.py a bit. (Closed)
Patch Set: update one more call to attempt_logout() Created 10 years, 9 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
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))

Powered by Google App Engine
This is Rietveld 408576698