Merge lp:~patrick-crews/drizzle/qp-sysbench into lp:drizzle
- qp-sysbench
- Merge into 7.2
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email: mp+111520@code.launchpad.net |
Commit message
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
1 | === modified file 'tests/lib/server_mgmt/drizzled.py' |
2 | --- tests/lib/server_mgmt/drizzled.py 2012-03-27 00:53:10 +0000 |
3 | +++ tests/lib/server_mgmt/drizzled.py 2012-06-21 23:35:23 +0000 |
4 | @@ -84,7 +84,7 @@ |
5 | } |
6 | } |
7 | } |
8 | - self.workdir = self.system_manager.create_dirset( workdir_root |
9 | + self.workdir = self.system_manager.create_dirset( self.test_executor.workdir |
10 | , self.dirset) |
11 | self.vardir = self.workdir |
12 | self.tmpdir = os.path.join(self.vardir,'tmp') |
13 | @@ -147,7 +147,9 @@ |
14 | |
15 | """ |
16 | |
17 | - server_args = [ self.process_server_options() |
18 | + server_args = [ "--no-defaults" |
19 | + , "--server-id=%d" %(int(self.name.split('s')[1])+1) |
20 | + , self.process_server_options() |
21 | , "--mysql-protocol.port=%d" %(self.master_port) |
22 | , "--mysql-protocol.connect-timeout=60" |
23 | , "--innodb.data-file-path=ibdata1:20M:autoextend" |
24 | |
25 | === modified file 'tests/lib/server_mgmt/server_management.py' |
26 | --- tests/lib/server_mgmt/server_management.py 2012-02-09 02:28:38 +0000 |
27 | +++ tests/lib/server_mgmt/server_management.py 2012-06-21 23:35:23 +0000 |
28 | @@ -64,28 +64,6 @@ |
29 | self.libeatmydata_path = variables['libeatmydatapath'] |
30 | |
31 | self.logging.info("Using default-storage-engine: %s" %(self.default_storage_engine)) |
32 | - test_server = self.allocate_server( 'test_bot' |
33 | - , None |
34 | - , [] |
35 | - , self.system_manager.workdir |
36 | - ) |
37 | - self.logging.info("Testing for Innodb / Xtradb version...") |
38 | - test_server.start(working_environ=os.environ) |
39 | - try: |
40 | - innodb_ver, xtradb_ver = test_server.get_engine_info() |
41 | - self.logging.info("Innodb version: %s" %innodb_ver) |
42 | - self.logging.info("Xtradb version: %s" %xtradb_ver) |
43 | - except Exception, e: |
44 | - self.logging.error("Problem detecting innodb/xtradb version:") |
45 | - self.logging.error(Exception) |
46 | - self.logging.error(e) |
47 | - self.logging.error("Dumping server error.log...") |
48 | - test_server.dump_errlog() |
49 | - test_server.stop() |
50 | - test_server.cleanup() |
51 | - shutil.rmtree(test_server.workdir) |
52 | - del(test_server) |
53 | - |
54 | self.logging.debug_class(self) |
55 | |
56 | def request_servers( self |
57 | |
58 | === modified file 'tests/lib/test_mgmt/test_execution.py' |
59 | --- tests/lib/test_mgmt/test_execution.py 2012-05-25 18:41:11 +0000 |
60 | +++ tests/lib/test_mgmt/test_execution.py 2012-06-21 23:35:23 +0000 |
61 | @@ -296,7 +296,7 @@ |
62 | #, 'MYSQL_BASEDIR' : self.system_manager.code_manager.code_trees['mysql'][0].basedir |
63 | , 'MYSQL_TEST_WORKDIR' : self.system_manager.workdir |
64 | , 'SQLBENCH_DIR' : os.path.join( self.system_manager.testdir |
65 | - , 'sql-bench') |
66 | + , 'test_tools/sql-bench') |
67 | } |
68 | |
69 | self.working_environment = self.system_manager.env_manager.create_working_environment(env_reqs) |
70 | |
71 | === modified file 'tests/lib/util/crashme_methods.py' |
72 | --- tests/lib/util/crashme_methods.py 2011-10-20 02:44:33 +0000 |
73 | +++ tests/lib/util/crashme_methods.py 2012-06-21 23:35:23 +0000 |
74 | @@ -70,7 +70,7 @@ |
75 | |
76 | crashme_subproc = subprocess.Popen( crashme_cmd |
77 | , shell=True |
78 | - , cwd=os.path.join(bot.system_manager.testdir, 'sql-bench') |
79 | + , cwd=os.path.join(bot.system_manager.testdir, 'test_tools/sql-bench') |
80 | , env=bot.working_environment |
81 | , stdout = crashme_output |
82 | , stderr = subprocess.STDOUT |
83 | |
84 | === modified file 'tests/lib/util/sqlbench_methods.py' |
85 | --- tests/lib/util/sqlbench_methods.py 2011-10-20 02:44:33 +0000 |
86 | +++ tests/lib/util/sqlbench_methods.py 2012-06-21 23:35:23 +0000 |
87 | @@ -35,7 +35,7 @@ |
88 | bot.logging.info("This may take some time...") |
89 | sqlbench_subproc = subprocess.Popen( test_cmd |
90 | , shell=True |
91 | - , cwd=os.path.join(bot.system_manager.testdir, 'sql-bench') |
92 | + , cwd=os.path.join(bot.system_manager.testdir, 'test_tools/sql-bench') |
93 | , env=bot.working_environment |
94 | , stdout = sqlbench_output |
95 | , stderr = subprocess.STDOUT |
96 | |
97 | === modified file 'tests/lib/util/sysbench_methods.py' |
98 | --- tests/lib/util/sysbench_methods.py 2012-05-29 21:27:11 +0000 |
99 | +++ tests/lib/util/sysbench_methods.py 2012-06-21 23:35:23 +0000 |
100 | @@ -20,80 +20,35 @@ |
101 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
102 | |
103 | import os |
104 | +import re |
105 | import subprocess |
106 | |
107 | -def execute_sqlbench(test_cmd, test_executor, servers): |
108 | - """ Execute the commandline and return the result. |
109 | - We use subprocess as we can pass os.environ dicts and whatnot |
110 | +def prepare_sysbench(test_executor, test_cmd): |
111 | + """ Prepare the server for a sysbench run |
112 | |
113 | """ |
114 | - |
115 | bot = test_executor |
116 | - sqlbench_outfile = os.path.join(bot.logdir,'sqlbench.out') |
117 | - sqlbench_output = open(sqlbench_outfile,'w') |
118 | - bot.logging.info("Executing sqlbench: %s" %(test_cmd)) |
119 | - bot.logging.info("This may take some time...") |
120 | - sqlbench_subproc = subprocess.Popen( test_cmd |
121 | - , shell=True |
122 | - , cwd=os.path.join(bot.system_manager.testdir, 'sql-bench') |
123 | - , env=bot.working_environment |
124 | - , stdout = sqlbench_output |
125 | + sysbench_outfile = os.path.join(bot.logdir,'sysbench.out') |
126 | + sysbench_output = open(sysbench_outfile,'w') |
127 | + sysbench_prep_cmd = ' '.join([test_cmd,'prepare']) |
128 | + bot.logging.info("Preparing database for sysbench run...") |
129 | + bot.logging.verbose(sysbench_prep_cmd) |
130 | + sysbench_subproc = subprocess.Popen( sysbench_prep_cmd |
131 | + , shell = True |
132 | + , env = bot.working_environment |
133 | + , stdout = sysbench_output |
134 | , stderr = subprocess.STDOUT |
135 | ) |
136 | - sqlbench_subproc.wait() |
137 | - retcode = sqlbench_subproc.returncode |
138 | - |
139 | - sqlbench_output.close() |
140 | - sqlbench_file = open(sqlbench_outfile,'r') |
141 | - output = ''.join(sqlbench_file.readlines()) |
142 | - sqlbench_file.close() |
143 | - |
144 | - bot.current_test_retcode = retcode |
145 | - bot.current_test_output = output |
146 | - test_status = process_sqlbench_output(bot) |
147 | - return test_status, retcode, output |
148 | - |
149 | -def process_sqlbench_output(bot): |
150 | - |
151 | - # Check for 'Failed' in sql-bench output |
152 | - # The tests don't die on a failed test and |
153 | - # require some checking of the output file |
154 | - error_flag = False |
155 | - for inline in bot.current_test_output: |
156 | - if 'Failed' in inline: |
157 | - error_flag= True |
158 | - logging.info(inline.strip()) |
159 | - if bot.current_test_retcode == 0 and not error_flag: |
160 | - return 'pass' |
161 | - else: |
162 | - return 'fail' |
163 | - |
164 | - def prepare_sysbench(test_executor, test_cmd): |
165 | - """ Prepare the server for a sysbench run |
166 | - |
167 | - """ |
168 | - bot = test_executor |
169 | - sysbench_outfile = os.path.join(bot.logdir,'sysbench.out') |
170 | - sysbench_output = open(sysbench_outfile,'w') |
171 | - sysbench_prep_cmd = ' '.join([test_cmd,'prepare']) |
172 | - bot.logging.info("Preparing database for sysbench run...") |
173 | - bot.logging.verbose(sysbench_prep_cmd) |
174 | - sysbench_subproc = subprocess.Popen( sysbench_prep_cmd |
175 | - , shell = True |
176 | - , env = bot.working_environment |
177 | - , stdout = sysbench_output |
178 | - , stderr = subprocess.STDOUT |
179 | - ) |
180 | - sysbench_subproc.wait() |
181 | - retcode = sysbench_subproc.returncode |
182 | - sysbench_output.close() |
183 | - with open(sysbench_outfile,'r') as sysbench_file: |
184 | - output = ''.join(sysbench_file.readlines()) |
185 | - sysbench_file.close() |
186 | - bot.logging.verbose("sysbench_retcode: %d" %(retcode)) |
187 | - return retcode, output |
188 | - |
189 | - def execute_sysbench(test_executor, test_cmd): |
190 | + sysbench_subproc.wait() |
191 | + retcode = sysbench_subproc.returncode |
192 | + sysbench_output.close() |
193 | + with open(sysbench_outfile,'r') as sysbench_file: |
194 | + output = ''.join(sysbench_file.readlines()) |
195 | + sysbench_file.close() |
196 | + bot.logging.verbose("sysbench_retcode: %d" %(retcode)) |
197 | + return retcode, output |
198 | + |
199 | +def execute_sysbench(test_executor, test_cmd): |
200 | """ Execute the commandline and return the result. |
201 | We use subprocess as we can pass os.environ dicts and whatnot |
202 | |
203 | @@ -101,7 +56,7 @@ |
204 | |
205 | bot = test_executor |
206 | sysbench_cmd = ' '.join([test_cmd, 'run']) |
207 | - self.logging.info("Executing sysbench: %s" %(sysbench_cmd)) |
208 | + bot.logging.info("Executing sysbench: %s" %(sysbench_cmd)) |
209 | sysbench_outfile = os.path.join(bot.logdir,'sysbench.out') |
210 | with open(sysbench_outfile,'w') as sysbench_output: |
211 | sysbench_subproc = subprocess.Popen( sysbench_cmd |
212 | @@ -116,11 +71,11 @@ |
213 | |
214 | sysbench_file = open(sysbench_outfile,'r') |
215 | output = ''.join(sysbench_file.readlines()) |
216 | - self.logging.debug(output) |
217 | + bot.logging.debug(output) |
218 | sysbench_file.close() |
219 | return retcode, output |
220 | |
221 | - def process_sysbench_output(test_output): |
222 | +def process_sysbench_output(test_output): |
223 | """ sysbench has run, we now check out what we have |
224 | We also output the data from the run |
225 | |
226 | |
227 | === modified file 'tests/qp_tests/sysbench/sysbench_readonly_test.py' |
228 | --- tests/qp_tests/sysbench/sysbench_readonly_test.py 2012-05-29 21:27:11 +0000 |
229 | +++ tests/qp_tests/sysbench/sysbench_readonly_test.py 2012-06-21 23:35:23 +0000 |
230 | @@ -21,19 +21,24 @@ |
231 | |
232 | import unittest |
233 | import subprocess |
234 | +import time |
235 | |
236 | from lib.util.sysbench_methods import prepare_sysbench |
237 | from lib.util.sysbench_methods import execute_sysbench |
238 | +from lib.util.sysbench_methods import process_sysbench_output |
239 | from lib.util.mysqlBaseTestCase import mysqlBaseTestCase |
240 | |
241 | -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']] |
242 | +# TODO: make server_options vary depending on the type of server being used here |
243 | +# drizzle options |
244 | +#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']] |
245 | +# mysql options |
246 | +#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']] |
247 | +server_requirements = [[]] |
248 | servers = [] |
249 | server_manager = None |
250 | test_executor = None |
251 | |
252 | class basicTest(mysqlBaseTestCase): |
253 | - def setUp(self): |
254 | - retcode, output = sysbench_methods.prepare_sysbench(test_executor, test_cmd) |
255 | |
256 | def test_sysbench_readonly(self): |
257 | self.logging = test_executor.logging |
258 | @@ -44,41 +49,54 @@ |
259 | , "--max-requests=0" |
260 | , "--test=oltp" |
261 | , "--db-ps-mode=disable" |
262 | - , "--drizzle-table-engine=innodb" |
263 | + , "--%s-table-engine=innodb" %master_server.type |
264 | , "--oltp-read-only=on" |
265 | , "--oltp-table-size=1000000" |
266 | - , "--drizzle-mysql=on" |
267 | - , "--drizzle-user=root" |
268 | - , "--drizzle-db=test" |
269 | - , "--drizzle-port=$MASTER_MYPORT" |
270 | - , "--drizzle-host=localhost" |
271 | - , "--db-driver=drizzle" |
272 | + , "--%s-user=root" %master_server.type |
273 | + , "--%s-db=test" %master_server.type |
274 | + , "--%s-port=%d" %(master_server.type, master_server.master_port) |
275 | + , "--%s-host=localhost" %master_server.type |
276 | + , "--db-driver=%s" %master_server.type |
277 | ] |
278 | - |
279 | + |
280 | + if master_server.type == 'drizzle': |
281 | + test_cmd.append("--drizzle-mysql=on") |
282 | + if master_server.type == 'mysql': |
283 | + test_cmd.append("--mysql-socket=%s" %master_server.socket_file) |
284 | + |
285 | + # We sleep for a minute to wait |
286 | + time.sleep(10) |
287 | # how many times to run sysbench at each concurrency |
288 | iterations = 1 |
289 | |
290 | # various concurrencies to use with sysbench |
291 | - concurrencies = [16, 32, 64, 128, 256, 512, 1024] |
292 | + #concurrencies = [16, 32, 64, 128, 256, 512, 1024] |
293 | + concurrencies = [1, 4, 8 ] |
294 | |
295 | # start the test! |
296 | for concurrency in concurrencies: |
297 | + self.logging.info("Resetting test server...") |
298 | + for query in ["DROP SCHEMA IF EXISTS test" |
299 | + ,"CREATE SCHEMA test" |
300 | + ]: |
301 | + retcode, result = self.execute_query(query, master_server, schema="INFORMATION_SCHEMA") |
302 | test_cmd.append("--num-threads=%d" %concurrency) |
303 | - # we setup once per concurrency, copying drizzle-automation |
304 | - # this should likely change and if not for readonly, then definitely |
305 | - # for readwrite |
306 | - retcode, output = sysbench_methods.prepare_sysbench(test_executor, test_cmd) |
307 | - self.assertEqual(retcode, 0, msg = ("sysbench 'prepare' phase failed.\n" |
308 | - "retcode: %d" |
309 | - "output: %s" |
310 | - %(retcode, output)) |
311 | - for iteration in iterations: |
312 | - test_cmd = " ".join(test_cmd) |
313 | - retcode, output = execute_sysbench(test_cmd, test_executor, servers) |
314 | + # we setup once per concurrency, copying drizzle-automation |
315 | + # this should likely change and if not for readonly, then definitely |
316 | + # for readwrite |
317 | + |
318 | + exec_cmd = " ".join(test_cmd) |
319 | + retcode, output = prepare_sysbench(test_executor, exec_cmd) |
320 | + err_msg = ("sysbench 'prepare' phase failed.\n" |
321 | + "retcode: %d" |
322 | + "output: %s" %(retcode,output)) |
323 | + self.assertEqual(retcode, 0, msg = err_msg) |
324 | + |
325 | + for test_iteration in range(iterations): |
326 | + retcode, output = execute_sysbench(test_executor, exec_cmd) |
327 | self.assertEqual(retcode, 0, msg = output) |
328 | - parsed_output = sysbench_methods.process_output(output) |
329 | - for line in parsed_output: |
330 | - self.logging.info(line) |
331 | + parsed_output = process_sysbench_output(output) |
332 | + self.logging.info(parsed_output) |
333 | |
334 | def tearDown(self): |
335 | server_manager.reset_servers(test_executor.name) |