| 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 |
| 6 import os, random, subprocess, time |
| 7 import commands, logging, random, time, utils |
| 8 from autotest_lib.client.bin import site_utils, test |
| 9 from autotest_lib.client.common_lib import error |
| 10 |
| 11 SUSPEND_START = '/tmp/power_state_cycle_begin' |
| 12 SUSPEND_END = '/tmp/power_state_cycle_end' |
| 13 CRYPTOHOMESTRESS_START = '/tmp/cryptohomestress_begin' |
| 14 CRYPTOHOMESTRESS_END = '/tmp/cryptohomestress_end' |
| 15 |
| 16 class platform_CryptohomeStress(test.test): |
| 17 version = 1 |
| 18 def initialize(self): |
| 19 for signal_file in [SUSPEND_END, CRYPTOHOMESTRESS_END]: |
| 20 if os.path.exists(signal_file): |
| 21 logging.warning('removing existing stop file %s' % signal_file) |
| 22 os.unlink(signal_file) |
| 23 random.seed() # System time is fine. |
| 24 |
| 25 |
| 26 def run_once(self, runtime=300): |
| 27 # check that fio has started, waiting for up to TIMEOUT |
| 28 site_utils.poll_for_condition( |
| 29 lambda: os.path.exists(CRYPTOHOMESTRESS_START), |
| 30 error.TestFail('fiostress not triggered.'), |
| 31 timeout=30, sleep_interval=1) |
| 32 open(SUSPEND_START, 'w').close() |
| 33 # Pad disk stress runtime by 60s for safety. |
| 34 runtime = runtime + 60 |
| 35 site_utils.poll_for_condition( |
| 36 lambda: os.path.exists(CRYPTOHOMESTRESS_END), |
| 37 error.TestFail('fiostress runtime exceeded.'), |
| 38 timeout=runtime, sleep_interval=10) |
| 39 |
| 40 def cleanup(self): |
| 41 open(SUSPEND_END, 'w').close() |
| 42 |
| OLD | NEW |