~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/lib/drizzle_test_run/dtr_test_management.py

  • Committer: patrick crews
  • Date: 2011-03-09 20:04:11 UTC
  • mto: (2231.1.1 build) (2239.2.2 build)
  • mto: This revision was merged to the branch mainline in revision 2232.
  • Revision ID: gleebix@gmail.com-20110309200411-868y1ssdbf5fqhcp
Updated dbqp magic so that we can execute slave tests.  We have to use .cnf files vs. .opt files, but this is the future anyway ; )  Added basic test + include file to ensure slave is sync'd prior to checking it

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import os
32
32
import re
33
33
import sys
 
34
from ConfigParser import RawConfigParser
34
35
 
35
36
import lib.test_mgmt.test_management as test_management
36
37
 
65
66
        self.master_count = 1
66
67
        self.server_options = test_server_options
67
68
        # We will populate this in a better fashion later on
68
 
        self.server_requirements=[self.server_options]
 
69
        # as we allow .cnf files, we need to do a bit of
 
70
        # messing about to make this work right
 
71
        if self.server_options == [] or type(self.server_options[0]) is not list:
 
72
            self.server_requirements=[self.server_options]
 
73
        else:
 
74
            self.server_requirements = self.server_options
69
75
        self.comment = comment
70
76
        self.master_sh = master_sh
71
77
        self.disable = disable
200
206
            master_sh = master_sh_path 
201
207
        else:
202
208
            master_sh = None
203
 
        master_opt_path = test_path.replace('.test','-master.opt')
 
209
        master_opt_path = test_path.replace('.test', '-master.opt')
 
210
        config_file_path = test_path.replace('.test', '.cnf')
204
211
        test_server_options = test_server_options + self.process_opt_file(
205
212
                                                           master_opt_path)
206
213
        (disable, comment) = self.check_if_disabled(disabled_tests, test_name)
259
266
            that reside at the suite-level if they exist.
260
267
            Return a list of the options found
261
268
 
 
269
            We also process .cnf files - this
 
270
            is currently dbqp-only and is the proper
 
271
            way to do things :P
 
272
 
262
273
        """
263
274
        found_options = []
264
275
        opt_files = ['t/master.opt','t/suite.opt']
265
276
        for opt_file in opt_files:
266
277
            found_options = found_options + self.process_opt_file(os.path.join(suite_dir,opt_file))
 
278
        # We also process the suite-level .cnf file(s).  We override
 
279
        # a master.opt file if we have a .cnf file.  There is no reason they
 
280
        # should ever be used in conjunction and I am biased towards .cnf ; )
 
281
        cnf_files = ['t/master.cnf']
 
282
        for cnf_file in cnf_files:
 
283
            found_options = self.process_cnf_file(os.path.join(suite_dir,cnf_file))
267
284
        return found_options
268
285
 
269
286
    def process_disabled_test_file(self, testdir):
342
359
        opt_file.close()
343
360
        return found_options
344
361
 
 
362
    def process_cnf_file(self, cnf_file_path):
 
363
        """ We extract meaningful information from a .cnf file
 
364
            if it exists.  Currently limited to server allocation
 
365
            needs
 
366
 
 
367
        """
 
368
 
 
369
        server_requirements = []
 
370
        if os.path.exists(cnf_file_path):
 
371
            config_reader = RawConfigParser()
 
372
            config_reader.read(cnf_file_path)
 
373
            server_requirements = self.process_server_reqs(config_reader.get('test_servers','servers'))
 
374
        return server_requirements
 
375
 
 
376
    def process_server_reqs(self,data_string):
 
377
        """ We read in the list of lists as a string, so we need to 
 
378
            handle this / break it down into proper chunks
 
379
 
 
380
        """
 
381
        server_reqs = []
 
382
        # We expect to see a list of lists and throw away the 
 
383
        # enclosing brackets
 
384
        option_sets = data_string[1:-1].strip().split(',')
 
385
        for option_set in option_sets:
 
386
            server_reqs.append([option_set[1:-1].strip()])
 
387
        return server_reqs
 
388
 
345
389
    def testlist_filter(self, testlist):
346
390
        """ Filter our list of testdir contents based on several 
347
391
            criteria.  This looks for user-specified test-cases