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:'
46
47
# We go through the various --basedir values provided
47
48
provided_basedirs = variables['basedir']
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)
55
self.test_tree = code_tree #first basedir = type under test
56
self.test_type = code_type
52
58
self.add_codeTree(code_type, code_tree)
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)
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
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)
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)
88
code_type = variables['defaultservertype']
74
89
if code_type == 'drizzle':
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
80
107
self.logging.error("Tree_type: %s not supported yet" %(tree_type))
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)
88
# We'll do something later, but we're cheating for now
89
# as we KNOW we're using drizzle code by default (only)
92
110
def get_tree(self, server_type, server_version):
93
111
""" We return an appropriate server tree for use in testing """