| OLD | NEW | 
|---|
| 1 import os, time, re, pwd | 1 import os, time, re, pwd | 
| 2 from autotest_lib.client.bin import test, utils | 2 from autotest_lib.client.bin import test, utils | 
| 3 from autotest_lib.client.common_lib import error | 3 from autotest_lib.client.common_lib import error | 
| 4 | 4 | 
| 5 | 5 | 
| 6 class sysbench(test.test): | 6 class sysbench(test.test): | 
| 7     version = 1 | 7     version = 1 | 
| 8 | 8 | 
| 9     def initialize(self): | 9     def initialize(self): | 
| 10         self.job.require_gcc() | 10         self.job.require_gcc() | 
| 11         self.results = [] | 11         self.results = [] | 
| 12 | 12 | 
| 13     # http://osdn.dl.sourceforge.net/sourceforge/sysbench/sysbench-0.4.8.tar.gz | 13     # http://osdn.dl.sourceforge.net/sourceforge/sysbench/sysbench-0.4.8.tar.gz | 
| 14     def setup(self, tarball = 'sysbench-0.4.8.tar.bz2'): | 14     def setup(self, tarball = 'sysbench-0.4.8.tar.bz2'): | 
| 15         tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 15         tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) | 
| 16         utils.extract_tarball_to_dir(tarball, self.srcdir) | 16         utils.extract_tarball_to_dir(tarball, self.srcdir) | 
| 17         self.job.setup_dep(['pgsql', 'mysql']) | 17         self.job.setup_dep(['pgsql', 'mysql']) | 
| 18 | 18 | 
| 19         os.chdir(self.srcdir) | 19         os.chdir(self.srcdir) | 
| 20 | 20 | 
| 21         pgsql_dir = os.path.join(self.autodir, 'deps/pgsql/pgsql') | 21         pgsql_dir = os.path.join(self.autodir, 'deps/pgsql/pgsql') | 
| 22         mysql_dir = os.path.join(self.autodir, 'deps/mysql/mysql') | 22         mysql_dir = os.path.join(self.autodir, 'deps/mysql/mysql') | 
| 23 | 23 | 
| 24         # configure wants to get at pg_config, so add its path | 24         # configure wants to get at pg_config, so add its path | 
| 25         utils.system( | 25         utils.system( | 
| 26             'PATH=%s/bin:$PATH ./configure --with-mysql=%s --with-pgsql' | 26             'PATH=%s/bin:$PATH ./configure --with-mysql=%s --with-pgsql' | 
| 27             % (pgsql_dir, mysql_dir)) | 27             % (pgsql_dir, mysql_dir)) | 
| 28         utils.system('make -j %d' % utils.count_cpus()) | 28         utils.make('-j %d' % utils.count_cpus()) | 
| 29 | 29 | 
| 30 | 30 | 
| 31     def run_once(self, db_type = 'pgsql', build = 1, \ | 31     def run_once(self, db_type = 'pgsql', build = 1, \ | 
| 32                     num_threads = utils.count_cpus(), max_time = 60, \ | 32                     num_threads = utils.count_cpus(), max_time = 60, \ | 
| 33                     read_only = 0, args = ''): | 33                     read_only = 0, args = ''): | 
| 34         plib = os.path.join(self.autodir, 'deps/pgsql/pgsql/lib') | 34         plib = os.path.join(self.autodir, 'deps/pgsql/pgsql/lib') | 
| 35         mlib = os.path.join(self.autodir, 'deps/mysql/mysql/lib/mysql') | 35         mlib = os.path.join(self.autodir, 'deps/mysql/mysql/lib/mysql') | 
| 36         ld_path = utils.prepend_path(plib, | 36         ld_path = utils.prepend_path(plib, | 
| 37             utils.environ('LD_LIBRARY_PATH')) | 37             utils.environ('LD_LIBRARY_PATH')) | 
| 38         ld_path = utils.prepend_path(mlib, ld_path) | 38         ld_path = utils.prepend_path(mlib, ld_path) | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 158             if threads_re: | 158             if threads_re: | 
| 159                 threads = threads_re.group(1) | 159                 threads = threads_re.group(1) | 
| 160 | 160 | 
| 161             tps_re = re.search('transactions:\s+\d+\s+\((\S+) per sec.\)', line) | 161             tps_re = re.search('transactions:\s+\d+\s+\((\S+) per sec.\)', line) | 
| 162             if tps_re: | 162             if tps_re: | 
| 163                 tps = tps_re.group(1) | 163                 tps = tps_re.group(1) | 
| 164                 break | 164                 break | 
| 165 | 165 | 
| 166         out.write('threads=%s\ntps=%s' % (threads, tps)) | 166         out.write('threads=%s\ntps=%s' % (threads, tps)) | 
| 167         out.close() | 167         out.close() | 
| OLD | NEW | 
|---|