~ubuntu-branches/ubuntu/vivid/drizzle/vivid-proposed

« back to all changes in this revision

Viewing changes to tests/lib/sys_mgmt/code_management.py

  • Committer: Package Import Robot
  • Author(s): Tobias Frost
  • Date: 2013-08-22 20:18:31 UTC
  • mto: (20.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20130822201831-gn3ozsh7o7wmc5tk
Tags: upstream-7.2.3
ImportĀ upstreamĀ versionĀ 7.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        self.system_manager = system_manager
43
43
        self.logging = self.system_manager.logging
44
44
        self.code_trees = {} # we store type: codeTree
 
45
        self.type_delimiter = ':type:'
45
46
 
46
47
        # We go through the various --basedir values provided
47
48
        provided_basedirs = variables['basedir']
 
49
        first = True
48
50
        for basedir in provided_basedirs:
49
51
            # We initialize a codeTree object
50
52
            # and store some information about it
51
53
            code_type, code_tree = self.process_codeTree(basedir, variables)
 
54
            if first:
 
55
                self.test_tree = code_tree #first basedir = type under test
 
56
                self.test_type = code_type
 
57
                first = False
52
58
            self.add_codeTree(code_type, code_tree)
53
59
 
54
 
 
55
60
    def add_codeTree(self, code_type, code_tree):
56
61
        # We add the codeTree to a list under 'type'
57
62
        # (mysql, drizzle, etc)
61
66
            self.code_trees[code_type] = []
62
67
        self.code_trees[code_type].append(code_tree)
63
68
 
64
 
    def process_codeTree(self, basedir, variables):
 
69
    def process_codeTree(self, basedir, variables, code_type=None):
65
70
        """Import the appropriate module depending on the type of tree
66
71
           we are testing. 
67
72
 
70
75
        """
71
76
 
72
77
        self.logging.verbose("Processing code rooted at basedir: %s..." %(basedir))
73
 
        code_type = self.get_code_type(basedir)
 
78
        # We comment out / remove the old get_code_type method
 
79
        # as the expectation is that the type will be passed as part of the 
 
80
        # basedir string / will be the default type (which will be configurable)
 
81
 
 
82
        #code_type = self.get_code_type(basedir)
 
83
        if basedir.find(self.type_delimiter) != -1:
 
84
            basedir, code_type = basedir.split(self.type_delimiter)
 
85
        elif code_type:
 
86
            code_type = code_type
 
87
        else:
 
88
            code_type = variables['defaultservertype']
74
89
        if code_type == 'drizzle':
75
90
            # base_case
76
91
            from lib.sys_mgmt.codeTree import drizzleTree
77
 
            test_tree = drizzleTree(variables,self.system_manager)
 
92
            test_tree = drizzleTree(basedir,variables,self.system_manager)
 
93
            return code_type, test_tree
 
94
        elif code_type == 'mysql':
 
95
            from lib.sys_mgmt.codeTree import mysqlTree
 
96
            test_tree = mysqlTree(basedir,variables,self.system_manager)
 
97
            return code_type, test_tree
 
98
        elif code_type == 'galera':
 
99
            from lib.sys_mgmt.codeTree import galeraTree
 
100
            test_tree = galeraTree(basedir, variables, self.system_manager)
 
101
            return code_type, test_tree
 
102
        elif code_type == 'percona':
 
103
            from lib.sys_mgmt.codeTree import perconaTree
 
104
            test_tree = perconaTree(basedir,variables,self.system_manager)
78
105
            return code_type, test_tree
79
106
        else:
80
107
            self.logging.error("Tree_type: %s not supported yet" %(tree_type))
81
108
            sys.exit(1)        
82
109
 
83
 
    def get_code_type(self, basedir):
84
 
        """ We do some quick scans of the basedir to determine
85
 
            what type of tree we are dealing with (mysql, drizzle, etc)
86
 
 
87
 
        """
88
 
        # We'll do something later, but we're cheating for now
89
 
        # as we KNOW we're using drizzle code by default (only)
90
 
        return 'drizzle'
91
 
 
92
110
    def get_tree(self, server_type, server_version):
93
111
        """ We return an appropriate server tree for use in testing """
94
112