OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import random, time |
| 6 from autotest_lib.client.common_lib import error, power_strip |
| 7 from autotest_lib.server import autotest, test |
| 8 |
| 9 class platform_CryptohomeSyncStressServer(test.test): |
| 10 version = 1 |
| 11 max_delay = 120 |
| 12 |
| 13 def run_once(self, host, power_addr, outlet, username, password): |
| 14 # check parameters |
| 15 if power_addr == None: |
| 16 raise error.TestFail('Missing power_addr argument.') |
| 17 if outlet == None: |
| 18 raise error.TestFail('Missing outlet argument.') |
| 19 if username == None: |
| 20 raise error.TestFail('Missing user parameter.') |
| 21 if password == None: |
| 22 raise error.TestFail('Missing pass parameter.') |
| 23 |
| 24 outlet = int(outlet) |
| 25 |
| 26 at = autotest.Autotest(host) |
| 27 boot_id = host.get_boot_id() |
| 28 |
| 29 # log in and verify things work |
| 30 self.job.set_state('client_fail', True) |
| 31 at.run_test('platform_CryptohomeSyncStress', |
| 32 username=username, password=password) |
| 33 if self.job.get_state('client_fail'): |
| 34 raise error.TestFail('Client test failed') |
| 35 |
| 36 # wait for some delay |
| 37 delay = random.randint(0, self.max_delay) |
| 38 print 'Delaying for %s seconds and then restarting.' % (delay) |
| 39 time.sleep(delay) |
| 40 |
| 41 # restart client |
| 42 power_strip.PowerStrip(power_addr).reboot(outlet) |
| 43 host.wait_for_restart(old_boot_id=boot_id) |
OLD | NEW |