1import os
2from autotest_lib.client.bin import test, utils
3
4
5class fsstress(test.test):
6    version = 1
7
8    def initialize(self):
9        self.job.require_gcc()
10
11
12    # http://www.zip.com.au/~akpm/linux/patches/stuff/ext3-tools.tar.gz
13    def setup(self, tarball = 'ext3-tools.tar.gz'):
14        self.tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
15        utils.extract_tarball_to_dir(self.tarball, self.srcdir)
16
17        os.chdir(self.srcdir)
18        utils.system('patch -p1 < ../fsstress-ltp.patch')
19        utils.system('patch -p1 < ../makefile.patch')
20        utils.make('fsstress')
21
22
23    def run_once(self, testdir = None, extra_args = '', nproc = '1000', nops = '1000'):
24        if not testdir:
25            testdir = self.tmpdir
26
27        args = '-d %s -p %s -n %s %s' % (testdir, nproc, nops, extra_args)
28        cmd = self.srcdir + '/fsstress ' + args
29        utils.system(cmd)
30