• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 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.client.cros.storage_tests import fio_test
8
9class hardware_StorageFioOther(fio_test.FioTest):
10    """
11    Runs several fio jobs on the non-root device and reports results.
12
13    fio (flexible I/O tester) is an I/O tool for benchmark and stress/hardware
14    verification.
15    """
16
17    version = 1
18    DEFAULT_FILE_SIZE = 1024 * 1024 * 1024
19
20    def initialize(self, dev='', filesize=DEFAULT_FILE_SIZE):
21        """
22        Set up local variables.
23
24        @param dev: block device / file to test.
25        @param filesize: size of the file. 0 means whole partition.
26                by default, 1GB.
27        """
28        if dev != '':
29            self._dev = dev
30        else:
31            devs = utils.get_other_device()
32            if len(devs) == 0:
33                raise error.TestFail("No other storage devices found")
34            elif len(devs) > 1:
35                raise error.TestFail("More than one other storage device found")
36            self._dev = devs[0]
37        super(hardware_StorageFioOther, self).initialize(dev=self._dev,
38                                                         filesize=filesize)
39
40    def run_once(self, dev='', quicktest=False, requirements=None,
41                 blkdiscard=True, integrity=False, wait=60 * 60 * 72):
42        """
43        Determines the non-root device to test, and then runs the
44        hardware_StorageFio test, which runs several fio jobs and reports
45        results.
46
47        @param dev: block device to test
48        @param quicktest: short test
49        @param requirements: list of jobs for fio to run
50        @param integrity: test to check data integrity
51        @param wait: seconds to wait between a write and subsequent verify
52        """
53        super(hardware_StorageFioOther,
54              self).run_once(dev=self._dev, quicktest=quicktest,
55                             requirements=requirements,
56                             blkdiscard=blkdiscard,
57                             integrity=integrity,
58                             wait=wait)
59