58
70
if variables['repeat'] <= 0:
59
71
print "Setting --repeat=1. You chose a silly value that I will ignore :P"
60
72
variables['repeat'] = 1
61
if variables['mode'] == 'randgen':
62
print "Setting --no-secure-file-priv=True for randgen mode..."
73
if variables['mode'] == 'randgen' or variables['gendatafile']:
74
print "Setting --no-secure-file-priv=True for randgen usage..."
63
75
variables['nosecurefilepriv']=True
64
76
if variables['mode'] == 'cleanup':
65
77
print "Setting --start-dirty=True for cleanup mode..."
66
78
variables['startdirty']=True
79
if variables['libeatmydata'] and os.path.exists(variables['libeatmydatapath']):
80
# We are using libeatmydata vs. shared mem for server speedup
81
print "Using libeatmydata at %s. Setting --no-shm / not using shared memory for testing..." %(variables['libeatmydatapath'])
82
variables['noshm']=True
85
def populate_defaults(variables, basedir_default):
86
""" We fill in any default values that need
87
to be put in post-parsing
90
if not variables['basedir']:
91
# We populate this value with the default now
92
# it allows us to have a default and have user
93
# supplied opts to override them
94
variables['basedir'].append(basedir_default)
97
def handle_user_opts(variables, basedir_default, testdir_default, suitepaths_default):
98
""" Some variables are dependent upon default values
99
We do the probably hacky thing of going through
100
and updating them accordingly
102
We make the assumption / decision that only
103
the first basedir value supplied should
104
be applicable when searching for tests
107
master_basedir = os.path.abspath(variables['basedir'][0])
108
if master_basedir != basedir_default:
109
new_path = os.path.join(master_basedir, 'plugin')
110
search_path = os.path.join(basedir_default,'plugin')
111
tmp = variables['suitepaths']
112
tmp[tmp.index(search_path)] = new_path
113
variables['suitepaths'] = tmp
114
if variables['testdir'] != testdir_default:
115
new_path = os.path.join(variables['testdir'],'suite')
116
search_path = os.path.join(testdir_default,'suite')
117
tmp = variables['suitepaths']
118
tmp[tmp.index(search_path)] = new_path
119
variables['suitepaths'] = tmp
69
123
# Create the CLI option parser
70
parser= optparse.OptionParser()
124
parser= optparse.OptionParser(version='%prog (database quality platform aka project steve austin) version 0.1.1')
72
# find some default values
73
# assume we are in-tree testing in general and operating from root/test(?)
126
# set some default values
74
127
testdir_default = os.path.abspath(os.getcwd())
76
server_default = os.path.abspath(os.path.join(testdir_default,
77
'../drizzled/drizzled'))
79
128
workdir_default = os.path.join(testdir_default,'workdir')
81
clientbindir_default = os.path.abspath(os.path.join(testdir_default,
129
clientbindir_default = os.path.abspath(os.path.join(testdir_default,'../client'))
84
130
basedir_default = os.path.split(testdir_default)[0]
87
# system_control_group - things like verbose, debug, etc
88
# test-runner affecting options
131
server_type_default = 'drizzle'
132
valgrind_suppression_default = os.path.join(testdir_default,'valgrind.supp')
133
suitepaths_default = [ os.path.join(basedir_default,'plugin')
134
, os.path.join(testdir_default,'suite')
136
randgen_path_default = os.path.join(testdir_default,'randgen')
139
config_control_group = optparse.OptionGroup(parser,
140
"Configuration controls - allows you to specify a file with a number of options already specified")
141
config_control_group.add_option(
143
, dest="sysconfigfilepath"
145
, default=None # We want to have a file that will be our default defaults file...
146
, help="The file that specifies system configuration specs for dbqp to execute tests (not yet implemented)"
148
parser.add_option_group(config_control_group)
89
151
system_control_group = optparse.OptionGroup(parser,
90
"Options for the test-runner itself")
92
system_control_group.add_option(
97
, help="Set this to continue test execution beyond the first failed test"
100
system_control_group.add_option(
102
, dest="startandexit"
103
, action="store_true"
105
, help="Spin up the server(s) for the first specified test then exit (will leave servers running)"
108
system_control_group.add_option(
111
, action="store_true"
113
, help="Produces extensive output about test-runner state. Distinct from --debug"
116
system_control_group.add_option(
119
, action="store_true"
121
, help="Provide internal-level debugging output. Distinct from --verbose"
124
system_control_group.add_option(
128
, help="Testing mode. We currently support dtr, randgen, and cleanup modes. See docs for further details about individual modes [%default]"
131
system_control_group.add_option(
134
, action="store_true"
136
, help="Record a testcase result (if the testing mode supports it) [%default]"
139
system_control_group.add_option(
142
, action="store_true"
144
, help="Don't try to cleanup from earlier runs (currently just a placeholder) [%default]"
147
system_control_group.add_option(
152
, help = "The path to a randgen installation that can be used to execute randgen-based tests"
152
"Options for the test-runner itself - defining the system under test and how to execute tests")
154
system_control_group.add_option(
157
, action="store_true"
159
, help="Set this to continue test execution beyond the first failed test"
162
system_control_group.add_option(
164
, dest="startandexit"
165
, action="store_true"
167
, help="Spin up the server(s) for the first specified test then exit (will leave servers running)"
170
system_control_group.add_option(
173
, action="store_true"
175
, help="Produces extensive output about test-runner state. Distinct from --debug"
178
system_control_group.add_option(
181
, action="store_true"
183
, help="Provide internal-level debugging output. Distinct from --verbose"
186
system_control_group.add_option(
190
, help="Testing mode. We currently support dtr, randgen, sysbench, sqlbench, crashme and cleanup modes. See docs for further details about individual modes [%default]"
193
system_control_group.add_option(
196
, action="store_true"
198
, help="Record a testcase result (if the testing mode supports it) [%default]"
201
system_control_group.add_option(
204
, action="store_true"
206
, help="Don't try to cleanup from earlier runs (currently just a placeholder) [%default]"
155
209
parser.add_option_group(system_control_group)
157
# end system_control_group
159
# test_control_group - things like suite, do-test, skip-test
160
# Affect which tests are run
161
211
test_control_group = optparse.OptionGroup(parser,
162
212
"Options for controlling which tests are executed")
165
214
test_control_group.add_option(
167
216
, dest="suitelist"
169
218
, action="callback"
170
219
, callback=comma_list_split
171
, help="The name of the suite containing tests we want. Can accept comma-separated list (with no spaces). Additional --suite args are appended to existing list [autosearch]"
220
, help="The name of the suite containing tests we want. Can accept comma-separated list (with no spaces). Additional --suite args are appended to existing list [autosearch]"
174
223
test_control_group.add_option(