46
46
def __init__(self, system_manager, test_case=None, test_name=None, suite_name=None
47
47
, suite_path=None, test_server_options=[], test_path=None, result_path=None
48
, comment=None, master_sh=None
48
, comment=None, master_sh=None, cnf_path=None
49
49
, disable=0, innodb_test=1
50
50
, need_debug=0, debug=0):
51
51
self.system_manager = system_manager
122
123
# Get suite-level options
123
124
suite_options = []
124
suite_options = self.process_suite_options(suite_dir)
125
cnf_path, suite_options = self.process_suite_options(suite_dir)
126
127
# Get the 'name' of the suite. This can require some processing
127
128
# But the name is useful for reporting and whatnot
145
146
disabled_tests = self.process_disabled_test_file(testdir)
146
147
for test_case in testlist:
147
148
self.add_test(self.process_test_file(suite_dir,
148
suite_name, suite_options
149
suite_name, cnf_path, suite_options
149
150
, disabled_tests, testdir
150
151
, resultdir, test_case))
152
def process_test_file(self, suite_dir, suite_name, suite_options
153
def process_test_file(self, suite_dir, suite_name, suite_cnf_path, suite_options
153
154
, disabled_tests, testdir
154
155
, resultdir, test_case):
155
156
""" We generate / find / store all the relevant information per-test.
175
177
, test_server_options
178
180
, need_debug) = self.gather_test_data(test_case, test_name,
179
181
suite_name, test_server_options,testdir,
180
resultdir, disabled_tests)
182
resultdir, disabled_tests)
183
if suite_cnf_path and not cnf_path:
184
cnf_path=suite_cnf_path
181
185
test_case = testCase(self.system_manager, test_case, test_name, suite_name,
182
186
suite_dir, test_server_options,test_path, result_path,
183
master_sh=master_sh, debug=self.debug)
187
master_sh=master_sh, cnf_path=cnf_path, debug=self.debug)
210
214
master_opt_path = test_path.replace('.test', '-master.opt')
211
215
config_file_path = test_path.replace('.test', '.cnf')
216
# NOTE: this currently makes suite level server options additive
217
# to file-level .opt files...not sure if this is the best.
212
218
test_server_options = test_server_options + self.process_opt_file(
220
# deal with .cnf files (which supercede master.opt stuff)
222
cnf_flag, returned_options = self.process_cnf_file(config_file_path)
223
cnf_options += returned_options
224
if cnf_flag: # we found a proper file and need to override
225
found_options = cnf_options
227
config_file_path = None
214
228
(disable, comment) = self.check_if_disabled(disabled_tests, test_name)
217
return (test_path, result_file_name, result_path, comment, master_sh,
218
test_server_options, disable, innodb_test, need_debug)
231
return (test_path, result_file_name, result_path, comment, master_sh,
232
config_file_path, test_server_options, disable, innodb_test, need_debug)
220
234
def check_suite(self, suite_dir, testdir, resultdir):
221
235
"""Handle basic checks of the suite:
280
294
# a master.opt file if we have a .cnf file. There is no reason they
281
295
# should ever be used in conjunction and I am biased towards .cnf ; )
282
296
cnf_files = ['t/master.cnf']
283
298
for cnf_file in cnf_files:
284
cnf_flag, returned_options = self.process_cnf_file(os.path.join(suite_dir,cnf_file))
285
if cnf_flag: # we found a proper file and need to override
286
found_options = returned_options
299
config_file_path = os.path.join(suite_dir,cnf_file)
300
cnf_flag, returned_options = self.process_cnf_file(config_file_path)
301
cnf_options += returned_options
302
if cnf_flag: # we found a proper file and need to override
303
found_options = cnf_options
305
config_file_path = None
306
return config_file_path, found_options
289
308
def process_disabled_test_file(self, testdir):
290
309
""" Checks and processes the suite's disabled.def