~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/lib/test_mgmt/test_execution.py

  • Committer: Mark Atwood
  • Date: 2011-10-11 22:37:47 UTC
  • mfrom: (2429.2.1 dbqp_revamp)
  • Revision ID: me@mark.atwood.name-20111011223747-vomebzgvnxxysqrm
mergeĀ lp:~patrick-crews/drizzle/dbqp_revamp

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        self.current_test_output = None
76
76
        self.current_test_exec_time = 0 
77
77
         
78
 
        if self.debug:
79
 
            self.logging.debug_class(self)
 
78
        self.logging.debug_class(self)
80
79
 
81
80
    def execute(self, start_and_exit):
82
81
        """ Execute a test case.  The details are *very* mode specific """
83
82
        self.status = 1 # we are running
84
83
        keep_running = 1
85
 
        if self.verbose:
86
 
            self.logging.verbose("Executor: %s beginning test execution..." %(self.name))
 
84
        self.logging.verbose("Executor: %s beginning test execution..." %(self.name))
87
85
        while self.test_manager.has_tests() and keep_running == 1:
88
86
            self.get_testCase()
89
87
            for i in range(self.testcase_repeat_count):
200
198
 
201
199
    def execute_testCase(self):
202
200
        """ Do whatever evil voodoo we must do to execute a testCase """
203
 
        if self.verbose:
204
 
            self.logging.verbose("Executor: %s executing test: %s" %(self.name, self.current_testcase.fullname))
 
201
        self.logging.verbose("Executor: %s executing test: %s" %(self.name, self.current_testcase.fullname))
205
202
 
206
203
    def record_test_result(self):
207
204
        """ We get the test_manager to record the result """
226
223
            method
227
224
 
228
225
        """
229
 
        
 
226
 
 
227
        self.process_environment_reqs()
 
228
        self.process_symlink_reqs()
 
229
        self.process_master_sh()  
230
230
        return
231
231
 
 
232
    def process_master_sh(self):
 
233
        """ We do what we need to if we have a master.sh file """
 
234
        if self.current_testcase.master_sh:
 
235
            retcode, output = self.system_manager.execute_cmd("/bin/sh %s" %(self.current_testcase.master_sh))
 
236
            self.logging.debug("retcode: %retcode")
 
237
            self.logging.debug("%output")
 
238
 
 
239
    def process_environment_reqs(self):
 
240
        """ We generate the ENV vars we need set
 
241
            and then ask systemManager to do so
 
242
 
 
243
        """
 
244
        # We need to have a default set / file / whatever based
 
245
        # on the dbqp config file / what we're using dbqp for
 
246
        # will move this dict elsewhere to make this method more generic
 
247
 
 
248
        env_reqs = { 'DRIZZLETEST_VARDIR': self.master_server.vardir
 
249
                   ,  'DRIZZLE_TMP_DIR': self.master_server.tmpdir
 
250
                   ,  'MASTER_MYSOCK': self.master_server.socket_file
 
251
                   ,  'MASTER_MYPORT': str(self.master_server.master_port)
 
252
                   ,  'MC_PORT': str(self.master_server.mc_port)
 
253
                   ,  'PBMS_PORT': str(self.master_server.pbms_port)
 
254
                   ,  'JSON_SERVER_PORT': str(self.master_server.json_server_port)
 
255
                   ,  'RABBITMQ_NODE_PORT': str(self.master_server.rabbitmq_node_port)
 
256
                   ,  'DRIZZLE_TCP_PORT': str(self.master_server.drizzle_tcp_port)
 
257
                   ,  'EXE_DRIZZLE': self.master_server.drizzle_client
 
258
                   ,  'MASTER_SERVER_SLAVE_CONFIG' : self.master_server.slave_config_file
 
259
                   ,  'DRIZZLE_DUMP': "%s --no-defaults -uroot -p%d" %( self.master_server.drizzledump
 
260
                                                        , self.master_server.master_port)
 
261
                   ,  'DRIZZLE_SLAP': "%s -uroot -p%d" %( self.master_server.drizzleslap
 
262
                                                        , self.master_server.master_port)
 
263
                   ,  'DRIZZLE_IMPORT': "%s -uroot -p%d" %( self.master_server.drizzleimport
 
264
                                                          , self.master_server.master_port)
 
265
                   ,  'DRIZZLE': "%s -uroot -p%d" %( self.master_server.drizzle_client
 
266
                                                   , self.master_server.master_port)
 
267
                   ,  'DRIZZLE_BASEDIR' : self.system_manager.code_manager.code_trees['drizzle'][0].basedir
 
268
                   ,  'DRIZZLE_TRX_READER' : self.master_server.trx_reader
 
269
                   ,  'DRIZZLE_TEST_WORKDIR' : self.system_manager.workdir
 
270
                   }     
 
271
 
 
272
        self.working_environment = self.system_manager.env_manager.create_working_environment(env_reqs)
 
273
 
 
274
    def process_symlink_reqs(self):
 
275
        """ Create any symlinks we may need """
 
276
        needed_symlinks = []
 
277
 
 
278
        self.system_manager.create_symlinks(needed_symlinks)
 
279
 
 
280
    
 
281
   
 
282
 
 
283
 
232
284