1 import os, logging 2 from autotest_lib.client.bin import test, utils 3 4 5 class tiobench(test.test): 6 version = 1 7 8 # http://prdownloads.sourceforge.net/tiobench/tiobench-0.3.3.tar.gz 9 def setup(self, tarball = 'tiobench-0.3.3.tar.bz2'): 10 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) 11 utils.extract_tarball_to_dir(tarball, self.srcdir) 12 os.chdir(self.srcdir) 13 utils.system('patch -p1 < ../makefile.patch') 14 utils.system('make') 15 16 17 def initialize(self): 18 self.job.require_gcc() 19 20 21 def run_once(self, dir = None, args = None): 22 if not dir: 23 self.dir = self.tmpdir 24 else: 25 self.dir = dir 26 if not args: 27 self.args = '--block=4096 --block=8192 --threads=10 --size=1024 --numruns=2' 28 else: 29 self.args = args 30 31 os.chdir(self.srcdir) 32 results = utils.system_output('./tiobench.pl --dir %s %s' % 33 (self.dir, self.args)) 34 35 logging.info(results) 36 results_path = os.path.join(self.resultsdir, 37 'raw_output_%s' % self.iteration) 38 39 utils.open_write_close(results_path, results) 40