summaryrefslogtreecommitdiff
path: root/client/tests/fio/fio.py
blob: aad6bf7e2a661e9a50a73c6ad5d68d4f239014ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
from autotest_lib.client.bin import test, autotest_utils
from autotest_lib.client.common_lib import utils


class fio(test.test):
    version = 2

    # http://brick.kernel.dk/snaps/fio-1.16.5.tar.bz2
    def setup(self, tarball = 'fio-1.16.5.tar.bz2'):
        tarball = utils.unmap_url(self.bindir, tarball,
                                           self.tmpdir)
        autotest_utils.extract_tarball_to_dir(tarball, self.srcdir)

        self.job.setup_dep(['libaio'])
        ldflags = '-L' + self.autodir + '/deps/libaio/lib'
        cflags = '-I' + self.autodir + '/deps/libaio/include'
        var_ldflags = 'LDFLAGS="' + ldflags + '"'
        var_cflags  = 'CFLAGS="' + cflags + '"'

        os.chdir(self.srcdir)
        utils.system('patch -p1 < ../Makefile.patch')
        utils.system('%s %s make' % (var_ldflags, var_cflags))

    def execute(self, args = '', user = 'root'):
        os.chdir(self.srcdir)
        ##vars = 'TMPDIR=\"%s\" RESULTDIR=\"%s\"' % (self.tmpdir, self.resultsdir)
        vars = 'LD_LIBRARY_PATH="' + self.autodir + '/deps/libaio/lib"'
        ##args = '-m -o ' + self.resultsdir + '/fio-tio.log ' + self.srcdir + '/examples/tiobench-example';
        args = '--output ' + self.resultsdir + '/fio-mixed.log ' + self.bindir + '/fio-mixed.job';
        utils.system(vars + ' ./fio ' + args)

        # Do a profiling run if necessary
        profilers = self.job.profilers
        if profilers.present():
            profilers.start(self)
            utils.system(vars + ' ./fio ' + args)
            profilers.stop(self)
            profilers.report(self)