1import os 2from autotest_lib.client.bin import test, utils 3 4 5class spew(test.test): 6 version = 1 7 8 def initialize(self): 9 self.job.require_gcc() 10 11 12 # ftp://ftp.berlios.de/pub/spew/1.0.5/spew-1.0.5.tgz 13 def setup(self, tarball = 'spew-1.0.5.tgz'): 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.configure() 19 utils.make() 20 21 22 def run_once(self, testdir = None, filesize='100M', type='write', 23 pattern='random'): 24 cmd = os.path.join(self.srcdir, 'src/spew') 25 if not testdir: 26 testdir = self.tmpdir 27 tmpfile = os.path.join(testdir, 'spew-test.%d' % os.getpid()) 28 results = os.path.join(self.resultsdir, 'stdout.%d' % self.iteration) 29 args = '--%s -p %s -b 2k -B 2M %s %s' % \ 30 (type, pattern, filesize, tmpfile) 31 cmd += ' ' + args 32 33 open(self.resultsdir + '/command', 'w').write(cmd + '\n') 34 self.job.logging.redirect(results) 35 try: 36 utils.system(cmd) 37 finally: 38 self.job.logging.restore() 39