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
=== modified file 'drizzle/automation/config/automation.cnf'
--- drizzle/automation/config/automation.cnf 2009-08-17 02:54:54 +0000
+++ drizzle/automation/config/automation.cnf 2009-08-26 19:03:38 +0000
@@ -46,8 +46,6 @@
46sqlbench_config_name= sysbench46sqlbench_config_name= sysbench
47# location of the sql bench repository47# location of the sql bench repository
48sqlbench_home= /home/drizzle/repos/sqlbench48sqlbench_home= /home/drizzle/repos/sqlbench
49# the script to run
50sqlbench_script= run-all-tests
51# Email recipients to receive a text regression report on completion of49# Email recipients to receive a text regression report on completion of
52# a sqlbench run. Comma separated.50# a sqlbench run. Comma separated.
53report_email= drizzle-benchmark@lists.launchpad.net51report_email= drizzle-benchmark@lists.launchpad.net
5452
=== added directory 'drizzle/automation/crashme'
=== added file 'drizzle/automation/crashme/__init__.py'
--- drizzle/automation/crashme/__init__.py 1970-01-01 00:00:00 +0000
+++ drizzle/automation/crashme/__init__.py 2009-09-08 19:05:12 +0000
@@ -0,0 +1,30 @@
1#! /usr/bin/python
2# -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4#
5# Copyright (C) 2009 Sun Microsystems
6#
7# Authors:
8#
9# Jay Pipes <joinfu@sun.com>
10#
11# This file is part of the Drizzle Automation Project.
12#
13# The Drizzle Automation Project is free software: you can redistribute it and/or modify
14# it under the terms of the GNU Lesser General Public License as published by
15# the Free Software Foundation.
16#
17# The Drizzle Automation Project is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU Lesser General Public License for more details.
21#
22# You should have received a copy of the GNU Lesser General Public License
23# along with The Drizzle Automation Project (see COPYING.LESSER). If not,
24# see <http://www.gnu.org/licenses/>.
25
26"""The Drizzle Automation Project Library - LCOV Code Coverage"""
27
28__copyright__= "Copyright 2009 Sun Microsystems"
29
30__all__= ['config', 'run']
031
=== added file 'drizzle/automation/crashme/run.py'
--- drizzle/automation/crashme/run.py 1970-01-01 00:00:00 +0000
+++ drizzle/automation/crashme/run.py 2009-09-09 18:26:46 +0000
@@ -0,0 +1,140 @@
1#! /usr/bin/python
2# -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
3# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4#
5# Copyright (C) 2009 Sun Microsystems
6#
7# Authors:
8#
9# Jay Pipes <joinfu@sun.com>
10# Lee Bieber <lee.bieber@sun.com>
11#
12# This file is part of the Drizzle Automation Project.
13#
14# The Drizzle Automation Project is free software: you can redistribute it and/or modify
15# it under the terms of the GNU Lesser General Public License as published by
16# the Free Software Foundation.
17#
18# The Drizzle Automation Project is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU Lesser General Public License for more details.
22#
23# You should have received a copy of the GNU Lesser General Public License
24# along with The Drizzle Automation Project (see COPYING.LESSER). If not,
25# see <http://www.gnu.org/licenses/>.
26
27"""Script to automate running and processing of benchmarks."""
28
29import sys
30import socket
31import os
32import os.path
33from drizzle.automation.lib import logging
34import commands
35import datetime
36import time
37
38
39def execute(processing_mode, variables):
40 # Set/verify some required variables, depending on the server we are benchmarking.
41
42 working_dir= variables['working_dir']
43 run_date= datetime.datetime.now().isoformat()
44 server_name= variables['server']
45 # need the location where the sqlbench repository is located to run the crash-me command
46 sqlbench_home= variables['sqlbench']['sqlbench_home']
47 os.chdir(working_dir)
48
49 # For BZR mode, the "version" of the server (used in identifying the
50 # command run when logging to the database) is the branch and revision number.
51 #
52 # For MySQL Sandbox mode, the version is the text after the "msb_" prefix
53 # on the sandbox.
54 if processing_mode == 'bzr':
55 server_version= "%s-%s" % (variables['bzr_branch'], variables['bzr_revision'])
56 else:
57 server_version= variables['mysql_sandbox'].split('_')[1] # Sandbox names are msb_XXXX (e.g. msb_6011 for MySQL 6.0.11)
58
59 # We must instantiate a server and a client adapter which
60 # are used to start/stop the server and to query it. Depending
61 # on the type of server we are testing/processing, we may also
62 # instantiate a "Builder" object, which is used to build the
63 # server from source...
64 if server_name in ['drizzled','drizzle']:
65
66 from drizzle.automation.builder.drizzled import DrizzledBzrBuilder as builder_adapter
67 from drizzle.automation.client.drizzledb import DrizzleClient as client_adapter
68
69 # Here, depending on the revision, we use a different adapter
70 # for the older drizzleadmin-controlled server...
71 if str(variables['bzr_revision']) != 'last:1' and int(variables['bzr_revision']) < 950:
72 from drizzle.automation.server.olddrizzled import DrizzledServer as server_adapter
73 else:
74 from drizzle.automation.server.drizzled import DrizzledServer as server_adapter
75
76 elif server_name in ['mysqld','mysql']:
77 from drizzle.automation.builder.mysqld import MySQLBzrBuilder as builder_adapter
78 from drizzle.automation.client.mysql import MySQLClient as client_adapter
79 from drizzle.automation.server.mysqld import MySQLdServer as server_adapter
80
81 else:
82 logging.error("Not yet implemented!")
83 sys.exit(1)
84
85 server= server_adapter(variables['working_dir'])
86 client= client_adapter(variables['working_dir'], server.getPort())
87
88 if variables['no_build'] is False:
89 builder= builder_adapter(variables['working_dir'])
90 builder.build(variables['force_build'])
91
92 server.stopAll()
93
94 # clean data directory (var)
95 server.clear()
96
97 # Start up the server...
98 server.start()
99
100 # change to the sqlbench repository location
101 os.chdir(sqlbench_home)
102
103 # output directory to store results using the bzr revision number - example - limits-1225
104 output_dirname= "limits-%s" % (variables['bzr_revision'])
105 if not os.path.isdir(output_dirname):
106 logging.info("Creating %s" % output_dirname)
107 os.mkdir(output_dirname)
108
109 output_filename= "%s/%s.cfg" % (output_dirname,server_name)
110
111 # remove the existing configuration file to start fresh
112 if os.path.exists(output_filename):
113 logging.info("Removing %s" % output_filename)
114 os.remove(output_filename)
115
116 # TEMPORARY HACK FOR NOW
117 # for now set some variable limits, these are filed as bug #419350 and should be removed after the bug is fixed
118 logging.info("Writing temporary limits to %s - TO BE REMOVED after bug #419350 is fixed" % output_filename)
119 output_file= open(output_filename,"w")
120 output_file.writelines("query_size=1048576\n")
121 output_file.writelines("max_text_size=1048576\n")
122 output_file.writelines("where_string_size=1048576\n")
123 output_file.writelines("select_string_size=1048576\n")
124 # do not remove this one, as we don't support '+' for concatenation
125 output_file.writelines("func_extra_concat_as_+=no\n")
126 output_file.flush()
127 output_file.close()
128
129 logging.info("Running crash-me --server=%s --dir=limits-%s --connect-options=port=%d --force" % (server_name, variables['bzr_revision'], server.getPort()))
130 crashme_options= "--server=%s --connect-options=port=%d --force --dir=limits-%s " % (server_name, server.getPort(), variables['bzr_revision'])
131 (retcode, output)= commands.getstatusoutput("./crash-me %s " % (crashme_options))
132 if retcode != 0:
133 logging.error("Failed to run crash-me. Got error %d:\n%s." % (retcode,output))
134 sys.exit(1)
135 else:
136 logging.info("crash-me completed succesfully.\n%s." % (output))
137
138 server.stop()
139
140 return True
0141
=== modified file 'drizzle/automation/lib/options.py'
--- drizzle/automation/lib/options.py 2009-08-17 02:54:54 +0000
+++ drizzle/automation/lib/options.py 2009-08-26 19:03:38 +0000
@@ -33,11 +33,12 @@
3333
34# The valid commands for the automation runner34# The valid commands for the automation runner
35valid_commands= [35valid_commands= [
36 'lcov'36 'crashme'
37, 'doxy'37, 'doxy'
38, 'lcov'
39, 'sloc'
38, 'sqlbench'40, 'sqlbench'
39, 'sysbench'41, 'sysbench'
40, 'sloc'
41, 'valgrind'42, 'valgrind'
42]43]
4344
@@ -46,11 +47,12 @@
4647
47Where COMMAND is one of:48Where COMMAND is one of:
4849
50crashme Run crash-me limits test
51doxy Process Doxygen source code documentation
49lcov Process LCOV code coverage52lcov Process LCOV code coverage
50sqlbench Run benchmarks using sqlbench53sqlbench Run benchmarks using sqlbench
51sysbench Run benchmarks using sysbench54sysbench Run benchmarks using sysbench
52sloc Process SLOC coverage55sloc Process SLOC coverage
53doxy Process Doxygen source code documentation
54valgrind Process Valgrind tests"""56valgrind Process Valgrind tests"""
5557
56# Create the CLI option parser58# Create the CLI option parser
5759
=== modified file 'drizzle/automation/runner.py'
--- drizzle/automation/runner.py 2009-08-17 02:54:54 +0000
+++ drizzle/automation/runner.py 2009-08-26 19:03:38 +0000
@@ -126,6 +126,8 @@
126 126
127 if command == 'sloc':127 if command == 'sloc':
128 from drizzle.automation.sloc import run as runner128 from drizzle.automation.sloc import run as runner
129 elif command == 'crashme':
130 from drizzle.automation.crashme import run as runner
129 elif command == 'lcov':131 elif command == 'lcov':
130 from drizzle.automation.lcov import run as runner132 from drizzle.automation.lcov import run as runner
131 elif command == 'sqlbench':133 elif command == 'sqlbench':
132134
=== modified file 'drizzle/automation/sqlbench/run.py'
--- drizzle/automation/sqlbench/run.py 2009-08-22 05:03:28 +0000
+++ drizzle/automation/sqlbench/run.py 2009-09-08 19:05:12 +0000
@@ -164,7 +164,6 @@
164 # need the location where the sqlbench repository is located164 # need the location where the sqlbench repository is located
165 sqlbench_home= variables['sqlbench']['sqlbench_home']165 sqlbench_home= variables['sqlbench']['sqlbench_home']
166 # the name of the script to run 166 # the name of the script to run
167 sqlbench_script= variables['sqlbench']['sqlbench_script']
168 # sqlbench_config_name is set to "sqlbench" for now167 # sqlbench_config_name is set to "sqlbench" for now
169 sqlbench_config_name= variables['sqlbench']['sqlbench_config_name']168 sqlbench_config_name= variables['sqlbench']['sqlbench_config_name']
170 os.chdir(working_dir)169 os.chdir(working_dir)
@@ -229,6 +228,7 @@
229 config_id= getConfigId(sqlbench_config_name)228 config_id= getConfigId(sqlbench_config_name)
230229
231 os.chdir(sqlbench_home)230 os.chdir(sqlbench_home)
231 sqlbench_script= "./run-all-tests"
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()))
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())
234 result= run_sqlbench(sqlbench_script, sqlbench_options)234 result= run_sqlbench(sqlbench_script, sqlbench_options)
@@ -250,7 +250,7 @@
250 from drizzle.automation.lib import util250 from drizzle.automation.lib import util
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']))
252 logging.info("Sending email...")252 logging.info("Sending email...")
253 from_string= ('%s <drizzle-benchmark@lists.launchpad.net>' % socket.gethostname())253 from_string= ('%s <eday@oddments.org>' % socket.gethostname())
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)
255255
256 return True256 return True
257257
=== modified file 'setup.py'
--- setup.py 2009-08-21 05:33:54 +0000
+++ setup.py 2009-08-26 19:03:38 +0000
@@ -67,6 +67,7 @@
67 "drizzle.automation.sloc",67 "drizzle.automation.sloc",
68 "drizzle.automation.sysbench",68 "drizzle.automation.sysbench",
69 "drizzle.automation.sqlbench",69 "drizzle.automation.sqlbench",
70 "drizzle.automation.crashme",
70 ],71 ],
71 entry_points= {72 entry_points= {
72 'console_scripts': [73 'console_scripts': [

Subscribers

People subscribed via source and target branches

to all changes: