Merge lp://qastaging/~kalebral-deactivatedaccount/drizzle-automation/drizzle-automation-crashme into lp://qastaging/drizzle-automation

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

This proposal supersedes a proposal from 2009-09-09.

To post a comment you must log in.
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote : Posted in a previous version of this proposal

changes for integrating crashme into the drizzle-automation framework

Revision history for this message
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_filename,"w")

Please have variables named with undercored names.

So, I recommend something like:

output_file= open(output_filename,"w")

3)

266 - from_string= ('%s <email address hidden>' % socket.gethostname())
267 + from_string= ('%s <email address hidden>' % socket.gethostname())

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

Subscribers

People subscribed via source and target branches

to all changes: