fiotest.py 1.1 KB
Newer Older
1 2 3 4 5
#!/usr/bin/python

import os

from avocado import test
6
from avocado.core import job
7 8 9 10 11
from avocado.utils import archive
from avocado.utils import build
from avocado.utils import process


12
class FioTest(test.Test):
13 14 15 16 17 18 19 20

    """
    fio is an I/O tool meant to be used both for benchmark and
    stress/hardware verification.

    :see: http://freecode.com/projects/fio
    """

21
    def setUp(self):
22 23 24
        """
        Build 'fio'.
        """
25 26
        fio_tarball = self.params.get('fio_tarball', 'fio-2.1.10.tar.bz2')
        tarball_path = self.get_data_path(fio_tarball)
27
        archive.extract(tarball_path, self.srcdir)
28
        fio_version = fio_tarball.split('.tar.')[0]
29 30 31
        self.srcdir = os.path.join(self.srcdir, fio_version)
        build.make(self.srcdir)

32
    def runTest(self):
33 34 35 36
        """
        Execute 'fio' with appropriate parameters.
        """
        os.chdir(self.srcdir)
37 38
        fio_job = self.params.get('fio_job', 'fio-mixed.job')
        cmd = ('./fio %s' % self.get_data_path(fio_job))
39 40 41 42 43
        process.system(cmd)


if __name__ == "__main__":
    job.main()