Merge lp:~patrick-crews/drizzle/qp-sysbench into lp:drizzle

Proposed by Patrick Crews
Status: Merged
Approved by: Brian Aker
Approved revision: 2574
Merged at revision: 2568
Proposed branch: lp:~patrick-crews/drizzle/qp-sysbench
Merge into: lp:drizzle
Diff against target: 335 lines (+76/-123)
7 files modified
tests/lib/server_mgmt/drizzled.py (+4/-2)
tests/lib/server_mgmt/server_management.py (+0/-22)
tests/lib/test_mgmt/test_execution.py (+1/-1)
tests/lib/util/crashme_methods.py (+1/-1)
tests/lib/util/sqlbench_methods.py (+1/-1)
tests/lib/util/sysbench_methods.py (+25/-70)
tests/qp_tests/sysbench/sysbench_readonly_test.py (+44/-26)
To merge this branch: bzr merge lp:~patrick-crews/drizzle/qp-sysbench
Reviewer Review Type Date Requested Status
Drizzle Trunk Pending
Review via email: mp+111520@code.launchpad.net

Description of the change

Fixes to the sysbench suite + some code cleanups.
Fixed an issue where test server paths weren't correct.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/lib/server_mgmt/drizzled.py'
--- tests/lib/server_mgmt/drizzled.py 2012-03-27 00:53:10 +0000
+++ tests/lib/server_mgmt/drizzled.py 2012-06-21 23:35:23 +0000
@@ -84,7 +84,7 @@
84 }84 }
85 } 85 }
86 }86 }
87 self.workdir = self.system_manager.create_dirset( workdir_root87 self.workdir = self.system_manager.create_dirset( self.test_executor.workdir
88 , self.dirset)88 , self.dirset)
89 self.vardir = self.workdir89 self.vardir = self.workdir
90 self.tmpdir = os.path.join(self.vardir,'tmp')90 self.tmpdir = os.path.join(self.vardir,'tmp')
@@ -147,7 +147,9 @@
147 147
148 """148 """
149149
150 server_args = [ self.process_server_options()150 server_args = [ "--no-defaults"
151 , "--server-id=%d" %(int(self.name.split('s')[1])+1)
152 , self.process_server_options()
151 , "--mysql-protocol.port=%d" %(self.master_port)153 , "--mysql-protocol.port=%d" %(self.master_port)
152 , "--mysql-protocol.connect-timeout=60"154 , "--mysql-protocol.connect-timeout=60"
153 , "--innodb.data-file-path=ibdata1:20M:autoextend"155 , "--innodb.data-file-path=ibdata1:20M:autoextend"
154156
=== modified file 'tests/lib/server_mgmt/server_management.py'
--- tests/lib/server_mgmt/server_management.py 2012-02-09 02:28:38 +0000
+++ tests/lib/server_mgmt/server_management.py 2012-06-21 23:35:23 +0000
@@ -64,28 +64,6 @@
64 self.libeatmydata_path = variables['libeatmydatapath']64 self.libeatmydata_path = variables['libeatmydatapath']
6565
66 self.logging.info("Using default-storage-engine: %s" %(self.default_storage_engine))66 self.logging.info("Using default-storage-engine: %s" %(self.default_storage_engine))
67 test_server = self.allocate_server( 'test_bot'
68 , None
69 , []
70 , self.system_manager.workdir
71 )
72 self.logging.info("Testing for Innodb / Xtradb version...")
73 test_server.start(working_environ=os.environ)
74 try:
75 innodb_ver, xtradb_ver = test_server.get_engine_info()
76 self.logging.info("Innodb version: %s" %innodb_ver)
77 self.logging.info("Xtradb version: %s" %xtradb_ver)
78 except Exception, e:
79 self.logging.error("Problem detecting innodb/xtradb version:")
80 self.logging.error(Exception)
81 self.logging.error(e)
82 self.logging.error("Dumping server error.log...")
83 test_server.dump_errlog()
84 test_server.stop()
85 test_server.cleanup()
86 shutil.rmtree(test_server.workdir)
87 del(test_server)
88
89 self.logging.debug_class(self)67 self.logging.debug_class(self)
9068
91 def request_servers( self69 def request_servers( self
9270
=== modified file 'tests/lib/test_mgmt/test_execution.py'
--- tests/lib/test_mgmt/test_execution.py 2012-05-25 18:41:11 +0000
+++ tests/lib/test_mgmt/test_execution.py 2012-06-21 23:35:23 +0000
@@ -296,7 +296,7 @@
296 #, 'MYSQL_BASEDIR' : self.system_manager.code_manager.code_trees['mysql'][0].basedir296 #, 'MYSQL_BASEDIR' : self.system_manager.code_manager.code_trees['mysql'][0].basedir
297 , 'MYSQL_TEST_WORKDIR' : self.system_manager.workdir297 , 'MYSQL_TEST_WORKDIR' : self.system_manager.workdir
298 , 'SQLBENCH_DIR' : os.path.join( self.system_manager.testdir298 , 'SQLBENCH_DIR' : os.path.join( self.system_manager.testdir
299 , 'sql-bench')299 , 'test_tools/sql-bench')
300 } 300 }
301301
302 self.working_environment = self.system_manager.env_manager.create_working_environment(env_reqs)302 self.working_environment = self.system_manager.env_manager.create_working_environment(env_reqs)
303303
=== modified file 'tests/lib/util/crashme_methods.py'
--- tests/lib/util/crashme_methods.py 2011-10-20 02:44:33 +0000
+++ tests/lib/util/crashme_methods.py 2012-06-21 23:35:23 +0000
@@ -70,7 +70,7 @@
70 70
71 crashme_subproc = subprocess.Popen( crashme_cmd71 crashme_subproc = subprocess.Popen( crashme_cmd
72 , shell=True72 , shell=True
73 , cwd=os.path.join(bot.system_manager.testdir, 'sql-bench')73 , cwd=os.path.join(bot.system_manager.testdir, 'test_tools/sql-bench')
74 , env=bot.working_environment74 , env=bot.working_environment
75 , stdout = crashme_output75 , stdout = crashme_output
76 , stderr = subprocess.STDOUT76 , stderr = subprocess.STDOUT
7777
=== modified file 'tests/lib/util/sqlbench_methods.py'
--- tests/lib/util/sqlbench_methods.py 2011-10-20 02:44:33 +0000
+++ tests/lib/util/sqlbench_methods.py 2012-06-21 23:35:23 +0000
@@ -35,7 +35,7 @@
35 bot.logging.info("This may take some time...")35 bot.logging.info("This may take some time...")
36 sqlbench_subproc = subprocess.Popen( test_cmd36 sqlbench_subproc = subprocess.Popen( test_cmd
37 , shell=True37 , shell=True
38 , cwd=os.path.join(bot.system_manager.testdir, 'sql-bench')38 , cwd=os.path.join(bot.system_manager.testdir, 'test_tools/sql-bench')
39 , env=bot.working_environment39 , env=bot.working_environment
40 , stdout = sqlbench_output40 , stdout = sqlbench_output
41 , stderr = subprocess.STDOUT41 , stderr = subprocess.STDOUT
4242
=== modified file 'tests/lib/util/sysbench_methods.py'
--- tests/lib/util/sysbench_methods.py 2012-05-29 21:27:11 +0000
+++ tests/lib/util/sysbench_methods.py 2012-06-21 23:35:23 +0000
@@ -20,80 +20,35 @@
20# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA20# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2121
22import os22import os
23import re
23import subprocess24import subprocess
2425
25def execute_sqlbench(test_cmd, test_executor, servers):26def prepare_sysbench(test_executor, test_cmd):
26 """ Execute the commandline and return the result.27 """ Prepare the server for a sysbench run
27 We use subprocess as we can pass os.environ dicts and whatnot
2828
29 """29 """
30
31 bot = test_executor30 bot = test_executor
32 sqlbench_outfile = os.path.join(bot.logdir,'sqlbench.out')31 sysbench_outfile = os.path.join(bot.logdir,'sysbench.out')
33 sqlbench_output = open(sqlbench_outfile,'w')32 sysbench_output = open(sysbench_outfile,'w')
34 bot.logging.info("Executing sqlbench: %s" %(test_cmd))33 sysbench_prep_cmd = ' '.join([test_cmd,'prepare'])
35 bot.logging.info("This may take some time...")34 bot.logging.info("Preparing database for sysbench run...")
36 sqlbench_subproc = subprocess.Popen( test_cmd35 bot.logging.verbose(sysbench_prep_cmd)
37 , shell=True36 sysbench_subproc = subprocess.Popen( sysbench_prep_cmd
38 , cwd=os.path.join(bot.system_manager.testdir, 'sql-bench')37 , shell = True
39 , env=bot.working_environment38 , env = bot.working_environment
40 , stdout = sqlbench_output39 , stdout = sysbench_output
41 , stderr = subprocess.STDOUT40 , stderr = subprocess.STDOUT
42 )41 )
43 sqlbench_subproc.wait()42 sysbench_subproc.wait()
44 retcode = sqlbench_subproc.returncode 43 retcode = sysbench_subproc.returncode
4544 sysbench_output.close()
46 sqlbench_output.close()45 with open(sysbench_outfile,'r') as sysbench_file:
47 sqlbench_file = open(sqlbench_outfile,'r')46 output = ''.join(sysbench_file.readlines())
48 output = ''.join(sqlbench_file.readlines())47 sysbench_file.close()
49 sqlbench_file.close()48 bot.logging.verbose("sysbench_retcode: %d" %(retcode))
5049 return retcode, output
51 bot.current_test_retcode = retcode50
52 bot.current_test_output = output51def execute_sysbench(test_executor, test_cmd):
53 test_status = process_sqlbench_output(bot)
54 return test_status, retcode, output
55
56def process_sqlbench_output(bot):
57
58 # Check for 'Failed' in sql-bench output
59 # The tests don't die on a failed test and
60 # require some checking of the output file
61 error_flag = False
62 for inline in bot.current_test_output:
63 if 'Failed' in inline:
64 error_flag= True
65 logging.info(inline.strip())
66 if bot.current_test_retcode == 0 and not error_flag:
67 return 'pass'
68 else:
69 return 'fail'
70
71 def prepare_sysbench(test_executor, test_cmd):
72 """ Prepare the server for a sysbench run
73
74 """
75 bot = test_executor
76 sysbench_outfile = os.path.join(bot.logdir,'sysbench.out')
77 sysbench_output = open(sysbench_outfile,'w')
78 sysbench_prep_cmd = ' '.join([test_cmd,'prepare'])
79 bot.logging.info("Preparing database for sysbench run...")
80 bot.logging.verbose(sysbench_prep_cmd)
81 sysbench_subproc = subprocess.Popen( sysbench_prep_cmd
82 , shell = True
83 , env = bot.working_environment
84 , stdout = sysbench_output
85 , stderr = subprocess.STDOUT
86 )
87 sysbench_subproc.wait()
88 retcode = sysbench_subproc.returncode
89 sysbench_output.close()
90 with open(sysbench_outfile,'r') as sysbench_file:
91 output = ''.join(sysbench_file.readlines())
92 sysbench_file.close()
93 bot.logging.verbose("sysbench_retcode: %d" %(retcode))
94 return retcode, output
95
96 def execute_sysbench(test_executor, test_cmd):
97 """ Execute the commandline and return the result.52 """ Execute the commandline and return the result.
98 We use subprocess as we can pass os.environ dicts and whatnot 53 We use subprocess as we can pass os.environ dicts and whatnot
9954
@@ -101,7 +56,7 @@
101 56
102 bot = test_executor57 bot = test_executor
103 sysbench_cmd = ' '.join([test_cmd, 'run'])58 sysbench_cmd = ' '.join([test_cmd, 'run'])
104 self.logging.info("Executing sysbench: %s" %(sysbench_cmd))59 bot.logging.info("Executing sysbench: %s" %(sysbench_cmd))
105 sysbench_outfile = os.path.join(bot.logdir,'sysbench.out')60 sysbench_outfile = os.path.join(bot.logdir,'sysbench.out')
106 with open(sysbench_outfile,'w') as sysbench_output:61 with open(sysbench_outfile,'w') as sysbench_output:
107 sysbench_subproc = subprocess.Popen( sysbench_cmd62 sysbench_subproc = subprocess.Popen( sysbench_cmd
@@ -116,11 +71,11 @@
11671
117 sysbench_file = open(sysbench_outfile,'r')72 sysbench_file = open(sysbench_outfile,'r')
118 output = ''.join(sysbench_file.readlines())73 output = ''.join(sysbench_file.readlines())
119 self.logging.debug(output)74 bot.logging.debug(output)
120 sysbench_file.close()75 sysbench_file.close()
121 return retcode, output76 return retcode, output
122 77
123 def process_sysbench_output(test_output):78def process_sysbench_output(test_output):
124 """ sysbench has run, we now check out what we have 79 """ sysbench has run, we now check out what we have
125 We also output the data from the run80 We also output the data from the run
126 81
12782
=== modified file 'tests/qp_tests/sysbench/sysbench_readonly_test.py'
--- tests/qp_tests/sysbench/sysbench_readonly_test.py 2012-05-29 21:27:11 +0000
+++ tests/qp_tests/sysbench/sysbench_readonly_test.py 2012-06-21 23:35:23 +0000
@@ -21,19 +21,24 @@
2121
22import unittest22import unittest
23import subprocess23import subprocess
24import time
2425
25from lib.util.sysbench_methods import prepare_sysbench26from lib.util.sysbench_methods import prepare_sysbench
26from lib.util.sysbench_methods import execute_sysbench27from lib.util.sysbench_methods import execute_sysbench
28from lib.util.sysbench_methods import process_sysbench_output
27from lib.util.mysqlBaseTestCase import mysqlBaseTestCase29from lib.util.mysqlBaseTestCase import mysqlBaseTestCase
2830
29server_requirements = [['innodb.buffer-pool-size=256M innodb.log-file-size=64M innodb.log-buffer-size=8M innodb.thread-concurrency=0 innodb.additional-mem-pool-size=16M table-open-cache=4096 table-definition-cache=4096 mysql-protocol.max-connections=2048']]31# TODO: make server_options vary depending on the type of server being used here
32# drizzle options
33#server_requirements = [['innodb.buffer-pool-size=256M innodb.log-file-size=64M innodb.log-buffer-size=8M innodb.thread-concurrency=0 innodb.additional-mem-pool-size=16M table-open-cache=4096 table-definition-cache=4096 mysql-protocol.max-connections=2048']]
34# mysql options
35#server_requirements = [['innodb_buffer_pool_size=256M innodb_log_file_size=64M innodb_log_buffer_size=8M innodb_thread_concurrency=0 innodb_additional_mem_pool_size=16M table_open_cache=4096 table_definition_cache=4096 max_connections=2048']]
36server_requirements = [[]]
30servers = []37servers = []
31server_manager = None38server_manager = None
32test_executor = None39test_executor = None
3340
34class basicTest(mysqlBaseTestCase):41class basicTest(mysqlBaseTestCase):
35 def setUp(self):
36 retcode, output = sysbench_methods.prepare_sysbench(test_executor, test_cmd)
37 42
38 def test_sysbench_readonly(self):43 def test_sysbench_readonly(self):
39 self.logging = test_executor.logging44 self.logging = test_executor.logging
@@ -44,41 +49,54 @@
44 , "--max-requests=0"49 , "--max-requests=0"
45 , "--test=oltp"50 , "--test=oltp"
46 , "--db-ps-mode=disable"51 , "--db-ps-mode=disable"
47 , "--drizzle-table-engine=innodb" 52 , "--%s-table-engine=innodb" %master_server.type
48 , "--oltp-read-only=on"53 , "--oltp-read-only=on"
49 , "--oltp-table-size=1000000"54 , "--oltp-table-size=1000000"
50 , "--drizzle-mysql=on"55 , "--%s-user=root" %master_server.type
51 , "--drizzle-user=root"56 , "--%s-db=test" %master_server.type
52 , "--drizzle-db=test"57 , "--%s-port=%d" %(master_server.type, master_server.master_port)
53 , "--drizzle-port=$MASTER_MYPORT"58 , "--%s-host=localhost" %master_server.type
54 , "--drizzle-host=localhost"59 , "--db-driver=%s" %master_server.type
55 , "--db-driver=drizzle"
56 ]60 ]
57 61
62 if master_server.type == 'drizzle':
63 test_cmd.append("--drizzle-mysql=on")
64 if master_server.type == 'mysql':
65 test_cmd.append("--mysql-socket=%s" %master_server.socket_file)
66
67 # We sleep for a minute to wait
68 time.sleep(10)
58 # how many times to run sysbench at each concurrency69 # how many times to run sysbench at each concurrency
59 iterations = 170 iterations = 1
60 71
61 # various concurrencies to use with sysbench72 # various concurrencies to use with sysbench
62 concurrencies = [16, 32, 64, 128, 256, 512, 1024]73 #concurrencies = [16, 32, 64, 128, 256, 512, 1024]
74 concurrencies = [1, 4, 8 ]
6375
64 # start the test!76 # start the test!
65 for concurrency in concurrencies:77 for concurrency in concurrencies:
78 self.logging.info("Resetting test server...")
79 for query in ["DROP SCHEMA IF EXISTS test"
80 ,"CREATE SCHEMA test"
81 ]:
82 retcode, result = self.execute_query(query, master_server, schema="INFORMATION_SCHEMA")
66 test_cmd.append("--num-threads=%d" %concurrency)83 test_cmd.append("--num-threads=%d" %concurrency)
67 # we setup once per concurrency, copying drizzle-automation84 # we setup once per concurrency, copying drizzle-automation
68 # this should likely change and if not for readonly, then definitely85 # this should likely change and if not for readonly, then definitely
69 # for readwrite86 # for readwrite
70 retcode, output = sysbench_methods.prepare_sysbench(test_executor, test_cmd)87
71 self.assertEqual(retcode, 0, msg = ("sysbench 'prepare' phase failed.\n"88 exec_cmd = " ".join(test_cmd)
72 "retcode: %d"89 retcode, output = prepare_sysbench(test_executor, exec_cmd)
73 "output: %s"90 err_msg = ("sysbench 'prepare' phase failed.\n"
74 %(retcode, output))91 "retcode: %d"
75 for iteration in iterations:92 "output: %s" %(retcode,output))
76 test_cmd = " ".join(test_cmd) 93 self.assertEqual(retcode, 0, msg = err_msg)
77 retcode, output = execute_sysbench(test_cmd, test_executor, servers)94
95 for test_iteration in range(iterations):
96 retcode, output = execute_sysbench(test_executor, exec_cmd)
78 self.assertEqual(retcode, 0, msg = output)97 self.assertEqual(retcode, 0, msg = output)
79 parsed_output = sysbench_methods.process_output(output)98 parsed_output = process_sysbench_output(output)
80 for line in parsed_output:99 self.logging.info(parsed_output)
81 self.logging.info(line)
82100
83 def tearDown(self):101 def tearDown(self):
84 server_manager.reset_servers(test_executor.name)102 server_manager.reset_servers(test_executor.name)

Subscribers

People subscribed via source and target branches

to all changes: