Index: server/site_tests/platform_CryptohomeSyncStressServer/platform_CryptohomeSyncStressServer.py |
diff --git a/server/site_tests/platform_CryptohomeSyncStressServer/platform_CryptohomeSyncStressServer.py b/server/site_tests/platform_CryptohomeSyncStressServer/platform_CryptohomeSyncStressServer.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f6ee95718a71a4b1feaa2339f4a7480977af2197 |
--- /dev/null |
+++ b/server/site_tests/platform_CryptohomeSyncStressServer/platform_CryptohomeSyncStressServer.py |
@@ -0,0 +1,43 @@ |
+# Copyright (c) 2010 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 random, time |
+from autotest_lib.client.common_lib import error, power_strip |
+from autotest_lib.server import autotest, test |
+ |
+class platform_CryptohomeSyncStressServer(test.test): |
+ version = 1 |
+ max_delay = 120 |
+ |
+ def run_once(self, host, power_addr, outlet, username, password): |
+ # check parameters |
+ if power_addr == None: |
+ raise error.TestFail('Missing power_addr argument.') |
+ if outlet == None: |
+ raise error.TestFail('Missing outlet argument.') |
+ if username == None: |
+ raise error.TestFail('Missing user parameter.') |
+ if password == None: |
+ raise error.TestFail('Missing pass parameter.') |
+ |
+ outlet = int(outlet) |
+ |
+ at = autotest.Autotest(host) |
+ boot_id = host.get_boot_id() |
+ |
+ # log in and verify things work |
+ self.job.set_state('client_fail', True) |
+ at.run_test('platform_CryptohomeSyncStress', |
+ username=username, password=password) |
+ if self.job.get_state('client_fail'): |
+ raise error.TestFail('Client test failed') |
+ |
+ # wait for some delay |
+ delay = random.randint(0, self.max_delay) |
+ print 'Delaying for %s seconds and then restarting.' % (delay) |
+ time.sleep(delay) |
+ |
+ # restart client |
+ power_strip.PowerStrip(power_addr).reboot(outlet) |
+ host.wait_for_restart(old_boot_id=boot_id) |