Merge lp://qastaging/~kalebral-deactivatedaccount/drizzle-automation/drizzle-automation-crashme into lp://qastaging/drizzle-automation
- drizzle-automation-crashme
- Merge into trunk
Proposed by
Lee Bieber
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp://qastaging/~kalebral-deactivatedaccount/drizzle-automation/drizzle-automation-crashme |
Merge into: | lp://qastaging/drizzle-automation |
Diff against target: | None lines |
To merge this branch: | bzr merge lp://qastaging/~kalebral-deactivatedaccount/drizzle-automation/drizzle-automation-crashme |
Related bugs: |
This proposal supersedes a proposal from 2009-09-09.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Lee Bieber (kalebral-deactivatedaccount) wrote : Posted in a previous version of this proposal | # |
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
Hi! Great work! Just a few tiny things...
1)
193 + time.sleep(3)
You can remove that. The server.stop() method takes care of this.
2)
172 + FILE= open(output_
Please have variables named with undercored names.
So, I recommend something like:
output_file= open(output_
3)
266 - from_string= ('%s <email address hidden>' % socket.
267 + from_string= ('%s <email address hidden>' % socket.
Hmmm, I don't think this is future-proof :)
Make those simple cleanups and I'll merge immediately.
Great work, Lee!
Jay
review:
Needs Fixing
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'drizzle/automation/config/automation.cnf' | |||
2 | --- drizzle/automation/config/automation.cnf 2009-08-17 02:54:54 +0000 | |||
3 | +++ drizzle/automation/config/automation.cnf 2009-08-26 19:03:38 +0000 | |||
4 | @@ -46,8 +46,6 @@ | |||
5 | 46 | sqlbench_config_name= sysbench | 46 | sqlbench_config_name= sysbench |
6 | 47 | # location of the sql bench repository | 47 | # location of the sql bench repository |
7 | 48 | sqlbench_home= /home/drizzle/repos/sqlbench | 48 | sqlbench_home= /home/drizzle/repos/sqlbench |
8 | 49 | # the script to run | ||
9 | 50 | sqlbench_script= run-all-tests | ||
10 | 51 | # Email recipients to receive a text regression report on completion of | 49 | # Email recipients to receive a text regression report on completion of |
11 | 52 | # a sqlbench run. Comma separated. | 50 | # a sqlbench run. Comma separated. |
12 | 53 | report_email= drizzle-benchmark@lists.launchpad.net | 51 | report_email= drizzle-benchmark@lists.launchpad.net |
13 | 54 | 52 | ||
14 | === added directory 'drizzle/automation/crashme' | |||
15 | === added file 'drizzle/automation/crashme/__init__.py' | |||
16 | --- drizzle/automation/crashme/__init__.py 1970-01-01 00:00:00 +0000 | |||
17 | +++ drizzle/automation/crashme/__init__.py 2009-09-08 19:05:12 +0000 | |||
18 | @@ -0,0 +1,30 @@ | |||
19 | 1 | #! /usr/bin/python | ||
20 | 2 | # -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- | ||
21 | 3 | # vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | ||
22 | 4 | # | ||
23 | 5 | # Copyright (C) 2009 Sun Microsystems | ||
24 | 6 | # | ||
25 | 7 | # Authors: | ||
26 | 8 | # | ||
27 | 9 | # Jay Pipes <joinfu@sun.com> | ||
28 | 10 | # | ||
29 | 11 | # This file is part of the Drizzle Automation Project. | ||
30 | 12 | # | ||
31 | 13 | # The Drizzle Automation Project is free software: you can redistribute it and/or modify | ||
32 | 14 | # it under the terms of the GNU Lesser General Public License as published by | ||
33 | 15 | # the Free Software Foundation. | ||
34 | 16 | # | ||
35 | 17 | # The Drizzle Automation Project is distributed in the hope that it will be useful, | ||
36 | 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
37 | 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
38 | 20 | # GNU Lesser General Public License for more details. | ||
39 | 21 | # | ||
40 | 22 | # You should have received a copy of the GNU Lesser General Public License | ||
41 | 23 | # along with The Drizzle Automation Project (see COPYING.LESSER). If not, | ||
42 | 24 | # see <http://www.gnu.org/licenses/>. | ||
43 | 25 | |||
44 | 26 | """The Drizzle Automation Project Library - LCOV Code Coverage""" | ||
45 | 27 | |||
46 | 28 | __copyright__= "Copyright 2009 Sun Microsystems" | ||
47 | 29 | |||
48 | 30 | __all__= ['config', 'run'] | ||
49 | 0 | 31 | ||
50 | === added file 'drizzle/automation/crashme/run.py' | |||
51 | --- drizzle/automation/crashme/run.py 1970-01-01 00:00:00 +0000 | |||
52 | +++ drizzle/automation/crashme/run.py 2009-09-09 18:26:46 +0000 | |||
53 | @@ -0,0 +1,140 @@ | |||
54 | 1 | #! /usr/bin/python | ||
55 | 2 | # -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*- | ||
56 | 3 | # vim:expandtab:shiftwidth=2:tabstop=2:smarttab: | ||
57 | 4 | # | ||
58 | 5 | # Copyright (C) 2009 Sun Microsystems | ||
59 | 6 | # | ||
60 | 7 | # Authors: | ||
61 | 8 | # | ||
62 | 9 | # Jay Pipes <joinfu@sun.com> | ||
63 | 10 | # Lee Bieber <lee.bieber@sun.com> | ||
64 | 11 | # | ||
65 | 12 | # This file is part of the Drizzle Automation Project. | ||
66 | 13 | # | ||
67 | 14 | # The Drizzle Automation Project is free software: you can redistribute it and/or modify | ||
68 | 15 | # it under the terms of the GNU Lesser General Public License as published by | ||
69 | 16 | # the Free Software Foundation. | ||
70 | 17 | # | ||
71 | 18 | # The Drizzle Automation Project is distributed in the hope that it will be useful, | ||
72 | 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
73 | 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
74 | 21 | # GNU Lesser General Public License for more details. | ||
75 | 22 | # | ||
76 | 23 | # You should have received a copy of the GNU Lesser General Public License | ||
77 | 24 | # along with The Drizzle Automation Project (see COPYING.LESSER). If not, | ||
78 | 25 | # see <http://www.gnu.org/licenses/>. | ||
79 | 26 | |||
80 | 27 | """Script to automate running and processing of benchmarks.""" | ||
81 | 28 | |||
82 | 29 | import sys | ||
83 | 30 | import socket | ||
84 | 31 | import os | ||
85 | 32 | import os.path | ||
86 | 33 | from drizzle.automation.lib import logging | ||
87 | 34 | import commands | ||
88 | 35 | import datetime | ||
89 | 36 | import time | ||
90 | 37 | |||
91 | 38 | |||
92 | 39 | def execute(processing_mode, variables): | ||
93 | 40 | # Set/verify some required variables, depending on the server we are benchmarking. | ||
94 | 41 | |||
95 | 42 | working_dir= variables['working_dir'] | ||
96 | 43 | run_date= datetime.datetime.now().isoformat() | ||
97 | 44 | server_name= variables['server'] | ||
98 | 45 | # need the location where the sqlbench repository is located to run the crash-me command | ||
99 | 46 | sqlbench_home= variables['sqlbench']['sqlbench_home'] | ||
100 | 47 | os.chdir(working_dir) | ||
101 | 48 | |||
102 | 49 | # For BZR mode, the "version" of the server (used in identifying the | ||
103 | 50 | # command run when logging to the database) is the branch and revision number. | ||
104 | 51 | # | ||
105 | 52 | # For MySQL Sandbox mode, the version is the text after the "msb_" prefix | ||
106 | 53 | # on the sandbox. | ||
107 | 54 | if processing_mode == 'bzr': | ||
108 | 55 | server_version= "%s-%s" % (variables['bzr_branch'], variables['bzr_revision']) | ||
109 | 56 | else: | ||
110 | 57 | server_version= variables['mysql_sandbox'].split('_')[1] # Sandbox names are msb_XXXX (e.g. msb_6011 for MySQL 6.0.11) | ||
111 | 58 | |||
112 | 59 | # We must instantiate a server and a client adapter which | ||
113 | 60 | # are used to start/stop the server and to query it. Depending | ||
114 | 61 | # on the type of server we are testing/processing, we may also | ||
115 | 62 | # instantiate a "Builder" object, which is used to build the | ||
116 | 63 | # server from source... | ||
117 | 64 | if server_name in ['drizzled','drizzle']: | ||
118 | 65 | |||
119 | 66 | from drizzle.automation.builder.drizzled import DrizzledBzrBuilder as builder_adapter | ||
120 | 67 | from drizzle.automation.client.drizzledb import DrizzleClient as client_adapter | ||
121 | 68 | |||
122 | 69 | # Here, depending on the revision, we use a different adapter | ||
123 | 70 | # for the older drizzleadmin-controlled server... | ||
124 | 71 | if str(variables['bzr_revision']) != 'last:1' and int(variables['bzr_revision']) < 950: | ||
125 | 72 | from drizzle.automation.server.olddrizzled import DrizzledServer as server_adapter | ||
126 | 73 | else: | ||
127 | 74 | from drizzle.automation.server.drizzled import DrizzledServer as server_adapter | ||
128 | 75 | |||
129 | 76 | elif server_name in ['mysqld','mysql']: | ||
130 | 77 | from drizzle.automation.builder.mysqld import MySQLBzrBuilder as builder_adapter | ||
131 | 78 | from drizzle.automation.client.mysql import MySQLClient as client_adapter | ||
132 | 79 | from drizzle.automation.server.mysqld import MySQLdServer as server_adapter | ||
133 | 80 | |||
134 | 81 | else: | ||
135 | 82 | logging.error("Not yet implemented!") | ||
136 | 83 | sys.exit(1) | ||
137 | 84 | |||
138 | 85 | server= server_adapter(variables['working_dir']) | ||
139 | 86 | client= client_adapter(variables['working_dir'], server.getPort()) | ||
140 | 87 | |||
141 | 88 | if variables['no_build'] is False: | ||
142 | 89 | builder= builder_adapter(variables['working_dir']) | ||
143 | 90 | builder.build(variables['force_build']) | ||
144 | 91 | |||
145 | 92 | server.stopAll() | ||
146 | 93 | |||
147 | 94 | # clean data directory (var) | ||
148 | 95 | server.clear() | ||
149 | 96 | |||
150 | 97 | # Start up the server... | ||
151 | 98 | server.start() | ||
152 | 99 | |||
153 | 100 | # change to the sqlbench repository location | ||
154 | 101 | os.chdir(sqlbench_home) | ||
155 | 102 | |||
156 | 103 | # output directory to store results using the bzr revision number - example - limits-1225 | ||
157 | 104 | output_dirname= "limits-%s" % (variables['bzr_revision']) | ||
158 | 105 | if not os.path.isdir(output_dirname): | ||
159 | 106 | logging.info("Creating %s" % output_dirname) | ||
160 | 107 | os.mkdir(output_dirname) | ||
161 | 108 | |||
162 | 109 | output_filename= "%s/%s.cfg" % (output_dirname,server_name) | ||
163 | 110 | |||
164 | 111 | # remove the existing configuration file to start fresh | ||
165 | 112 | if os.path.exists(output_filename): | ||
166 | 113 | logging.info("Removing %s" % output_filename) | ||
167 | 114 | os.remove(output_filename) | ||
168 | 115 | |||
169 | 116 | # TEMPORARY HACK FOR NOW | ||
170 | 117 | # for now set some variable limits, these are filed as bug #419350 and should be removed after the bug is fixed | ||
171 | 118 | logging.info("Writing temporary limits to %s - TO BE REMOVED after bug #419350 is fixed" % output_filename) | ||
172 | 119 | output_file= open(output_filename,"w") | ||
173 | 120 | output_file.writelines("query_size=1048576\n") | ||
174 | 121 | output_file.writelines("max_text_size=1048576\n") | ||
175 | 122 | output_file.writelines("where_string_size=1048576\n") | ||
176 | 123 | output_file.writelines("select_string_size=1048576\n") | ||
177 | 124 | # do not remove this one, as we don't support '+' for concatenation | ||
178 | 125 | output_file.writelines("func_extra_concat_as_+=no\n") | ||
179 | 126 | output_file.flush() | ||
180 | 127 | output_file.close() | ||
181 | 128 | |||
182 | 129 | logging.info("Running crash-me --server=%s --dir=limits-%s --connect-options=port=%d --force" % (server_name, variables['bzr_revision'], server.getPort())) | ||
183 | 130 | crashme_options= "--server=%s --connect-options=port=%d --force --dir=limits-%s " % (server_name, server.getPort(), variables['bzr_revision']) | ||
184 | 131 | (retcode, output)= commands.getstatusoutput("./crash-me %s " % (crashme_options)) | ||
185 | 132 | if retcode != 0: | ||
186 | 133 | logging.error("Failed to run crash-me. Got error %d:\n%s." % (retcode,output)) | ||
187 | 134 | sys.exit(1) | ||
188 | 135 | else: | ||
189 | 136 | logging.info("crash-me completed succesfully.\n%s." % (output)) | ||
190 | 137 | |||
191 | 138 | server.stop() | ||
192 | 139 | |||
193 | 140 | return True | ||
194 | 0 | 141 | ||
195 | === modified file 'drizzle/automation/lib/options.py' | |||
196 | --- drizzle/automation/lib/options.py 2009-08-17 02:54:54 +0000 | |||
197 | +++ drizzle/automation/lib/options.py 2009-08-26 19:03:38 +0000 | |||
198 | @@ -33,11 +33,12 @@ | |||
199 | 33 | 33 | ||
200 | 34 | # The valid commands for the automation runner | 34 | # The valid commands for the automation runner |
201 | 35 | valid_commands= [ | 35 | valid_commands= [ |
203 | 36 | 'lcov' | 36 | 'crashme' |
204 | 37 | , 'doxy' | 37 | , 'doxy' |
205 | 38 | , 'lcov' | ||
206 | 39 | , 'sloc' | ||
207 | 38 | , 'sqlbench' | 40 | , 'sqlbench' |
208 | 39 | , 'sysbench' | 41 | , 'sysbench' |
209 | 40 | , 'sloc' | ||
210 | 41 | , 'valgrind' | 42 | , 'valgrind' |
211 | 42 | ] | 43 | ] |
212 | 43 | 44 | ||
213 | @@ -46,11 +47,12 @@ | |||
214 | 46 | 47 | ||
215 | 47 | Where COMMAND is one of: | 48 | Where COMMAND is one of: |
216 | 48 | 49 | ||
217 | 50 | crashme Run crash-me limits test | ||
218 | 51 | doxy Process Doxygen source code documentation | ||
219 | 49 | lcov Process LCOV code coverage | 52 | lcov Process LCOV code coverage |
220 | 50 | sqlbench Run benchmarks using sqlbench | 53 | sqlbench Run benchmarks using sqlbench |
221 | 51 | sysbench Run benchmarks using sysbench | 54 | sysbench Run benchmarks using sysbench |
222 | 52 | sloc Process SLOC coverage | 55 | sloc Process SLOC coverage |
223 | 53 | doxy Process Doxygen source code documentation | ||
224 | 54 | valgrind Process Valgrind tests""" | 56 | valgrind Process Valgrind tests""" |
225 | 55 | 57 | ||
226 | 56 | # Create the CLI option parser | 58 | # Create the CLI option parser |
227 | 57 | 59 | ||
228 | === modified file 'drizzle/automation/runner.py' | |||
229 | --- drizzle/automation/runner.py 2009-08-17 02:54:54 +0000 | |||
230 | +++ drizzle/automation/runner.py 2009-08-26 19:03:38 +0000 | |||
231 | @@ -126,6 +126,8 @@ | |||
232 | 126 | 126 | ||
233 | 127 | if command == 'sloc': | 127 | if command == 'sloc': |
234 | 128 | from drizzle.automation.sloc import run as runner | 128 | from drizzle.automation.sloc import run as runner |
235 | 129 | elif command == 'crashme': | ||
236 | 130 | from drizzle.automation.crashme import run as runner | ||
237 | 129 | elif command == 'lcov': | 131 | elif command == 'lcov': |
238 | 130 | from drizzle.automation.lcov import run as runner | 132 | from drizzle.automation.lcov import run as runner |
239 | 131 | elif command == 'sqlbench': | 133 | elif command == 'sqlbench': |
240 | 132 | 134 | ||
241 | === modified file 'drizzle/automation/sqlbench/run.py' | |||
242 | --- drizzle/automation/sqlbench/run.py 2009-08-22 05:03:28 +0000 | |||
243 | +++ drizzle/automation/sqlbench/run.py 2009-09-08 19:05:12 +0000 | |||
244 | @@ -164,7 +164,6 @@ | |||
245 | 164 | # need the location where the sqlbench repository is located | 164 | # need the location where the sqlbench repository is located |
246 | 165 | sqlbench_home= variables['sqlbench']['sqlbench_home'] | 165 | sqlbench_home= variables['sqlbench']['sqlbench_home'] |
247 | 166 | # the name of the script to run | 166 | # the name of the script to run |
248 | 167 | sqlbench_script= variables['sqlbench']['sqlbench_script'] | ||
249 | 168 | # sqlbench_config_name is set to "sqlbench" for now | 167 | # sqlbench_config_name is set to "sqlbench" for now |
250 | 169 | sqlbench_config_name= variables['sqlbench']['sqlbench_config_name'] | 168 | sqlbench_config_name= variables['sqlbench']['sqlbench_config_name'] |
251 | 170 | os.chdir(working_dir) | 169 | os.chdir(working_dir) |
252 | @@ -229,6 +228,7 @@ | |||
253 | 229 | config_id= getConfigId(sqlbench_config_name) | 228 | config_id= getConfigId(sqlbench_config_name) |
254 | 230 | 229 | ||
255 | 231 | os.chdir(sqlbench_home) | 230 | os.chdir(sqlbench_home) |
256 | 231 | sqlbench_script= "./run-all-tests" | ||
257 | 232 | logging.info("Running sqlbench --server=%s --dir=results-%s --log --connect-options=port=%d --bzr-repo=%s --machine=%s" % (server_name, variables['bzr_revision'], server.getPort(), working_dir, socket.gethostname())) | 232 | logging.info("Running sqlbench --server=%s --dir=results-%s --log --connect-options=port=%d --bzr-repo=%s --machine=%s" % (server_name, variables['bzr_revision'], server.getPort(), working_dir, socket.gethostname())) |
258 | 233 | sqlbench_options= "--server=%s --dir=results-%s --log --connect-options=port=%d --bzr-repo=%s --machine=%s" % (server_name, variables['bzr_revision'], server.getPort(), working_dir, socket.gethostname()) | 233 | sqlbench_options= "--server=%s --dir=results-%s --log --connect-options=port=%d --bzr-repo=%s --machine=%s" % (server_name, variables['bzr_revision'], server.getPort(), working_dir, socket.gethostname()) |
259 | 234 | result= run_sqlbench(sqlbench_script, sqlbench_options) | 234 | result= run_sqlbench(sqlbench_script, sqlbench_options) |
260 | @@ -250,7 +250,7 @@ | |||
261 | 250 | from drizzle.automation.lib import util | 250 | from drizzle.automation.lib import util |
262 | 251 | email_text= reports.getSysbenchRegressionReport(working_dir, run_date, server_name, variables['bzr_branch'], int(variables['bzr_revision'])) | 251 | email_text= reports.getSysbenchRegressionReport(working_dir, run_date, server_name, variables['bzr_branch'], int(variables['bzr_revision'])) |
263 | 252 | logging.info("Sending email...") | 252 | logging.info("Sending email...") |
265 | 253 | from_string= ('%s <drizzle-benchmark@lists.launchpad.net>' % socket.gethostname()) | 253 | from_string= ('%s <eday@oddments.org>' % socket.gethostname()) |
266 | 254 | util.mail(from_string, variables['sysbench']['report_email'], "SQLBENCH Regression Report - %s" % server_version, email_text) | 254 | util.mail(from_string, variables['sysbench']['report_email'], "SQLBENCH Regression Report - %s" % server_version, email_text) |
267 | 255 | 255 | ||
268 | 256 | return True | 256 | return True |
269 | 257 | 257 | ||
270 | === modified file 'setup.py' | |||
271 | --- setup.py 2009-08-21 05:33:54 +0000 | |||
272 | +++ setup.py 2009-08-26 19:03:38 +0000 | |||
273 | @@ -67,6 +67,7 @@ | |||
274 | 67 | "drizzle.automation.sloc", | 67 | "drizzle.automation.sloc", |
275 | 68 | "drizzle.automation.sysbench", | 68 | "drizzle.automation.sysbench", |
276 | 69 | "drizzle.automation.sqlbench", | 69 | "drizzle.automation.sqlbench", |
277 | 70 | "drizzle.automation.crashme", | ||
278 | 70 | ], | 71 | ], |
279 | 71 | entry_points= { | 72 | entry_points= { |
280 | 72 | 'console_scripts': [ | 73 | 'console_scripts': [ |
changes for integrating crashme into the drizzle-automation framework