1# Copyright (c) 2013 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
5from autotest_lib.client.bin import utils
6from autotest_lib.client.common_lib import error
7from autotest_lib.server import autotest
8from autotest_lib.server import hosts
9from autotest_lib.server import test
10
11
12class hardware_StorageQualSuspendStress(test.test):
13    """ Run Fio while suspending aggressively."""
14
15    version = 1
16
17    def run_once(self, client_ip, duration, other_dev=False):
18        client = hosts.create_host(client_ip)
19        client_at = autotest.Autotest(client)
20        timeout = int(duration * 1.5)
21        fio_test = "hardware_StorageFio"
22        if other_dev:
23            fio_test = "hardware_StorageFioOther"
24        control = """job.parallel(
25            [lambda: job.run_test('power_SuspendStress', tag='disk',
26                duration=%d, init_delay=10, min_suspend=7, min_resume=30,
27                check_connection=True)],
28            [lambda: job.run_test('%s', test_length=%d,
29                disable_sysinfo=True, requirements=[('write_stress', [])],
30                tag='qual_suspend')], timeout=%d)""" % \
31            (duration, fio_test, duration, timeout)
32        client_at.run(control, '.', None)
33        client_at.run_test(fio_test, wait=60, disable_sysinfo=True,
34                           blkdiscard=False,
35                           requirements=[('write_stress', ['v'])],
36                           tag='qual_verify')
37
38