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

Unified Diff: server/site_wifitest.py

Issue 3471015: Suspend- function for site_wifitest (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Fixed linespacing Created 10 years, 3 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
« no previous file with comments | « server/site_system_suspend.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/site_wifitest.py
diff --git a/server/site_wifitest.py b/server/site_wifitest.py
index 7be9311dd31862ae2c3b7a0a41266f95d0a0b95b..7fc0f161eac2de6f1a99642ede8fe81a669a8fb4 100644
--- a/server/site_wifitest.py
+++ b/server/site_wifitest.py
@@ -751,6 +751,37 @@ class WiFiTest(object):
self.client_netdump_thread = None
+ def client_suspend(self, params):
+ """ Suspend the system """
+
+ script_client_file = self.install_script('site_system_suspend.py',
+ '../client/common_lib/rtc.py',
+ '../client/common_lib/'
+ 'sys_power.py')
+ result = self.client.run('python "%s" %d' %
+ (script_client_file, int(params.get("suspend_time", 5))))
+
+
+ def client_suspend_bg(self, params):
+ """ Suspend the system in the background """
+
+ script_client_file = self.install_script('site_system_suspend.py',
+ '../client/common_lib/rtc.py',
+ '../client/common_lib/'
+ 'sys_power.py')
+ cmd = ('python "%s" %d' %
+ (script_client_file, int(params.get("suspend_time", 5))))
+ self.client_suspend_thread = HelperThread(self.client, cmd)
+ self.client_suspend_thread.start()
+
+
+ def client_suspend_end(self, params):
+ """ Join the backgrounded suspend thread """
+
+ self.client_suspend_thread.join()
+ if self.client_suspend_thread.result.exit_status:
+ raise error.TestError('suspend failed')
+
class HelperThread(threading.Thread):
# Class that wraps a ping command in a thread so it can run in the bg.
def __init__(self, client, cmd):
@@ -760,8 +791,7 @@ class HelperThread(threading.Thread):
def run(self):
# NB: set ignore_status as we're always terminated w/ pkill
- self.client.run(self.cmd, ignore_status=True)
-
+ self.result = self.client.run(self.cmd, ignore_status=True)
def __byfile(a, b):
if a['file'] < b['file']:
« no previous file with comments | « server/site_system_suspend.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698