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