---
libvirt-test-api.py | 7 +++++++
mapper.py | 24 +++++++++++++++++++-----
proxy.py | 13 +++++++++----
3 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/libvirt-test-api.py b/libvirt-test-api.py
index 8a4bacd..171e13c 100644
--- a/libvirt-test-api.py
+++ b/libvirt-test-api.py
@@ -100,13 +100,20 @@ class LibvirtTestAPI(object):
# extract the string of combination of
# language, package, testname of a testcase.
all_testcases_names = []
+ prev_casename = ''
for activity in activities_list:
for testcase in activity:
testcases_names = testcase.keys()
if 'sleep' in testcases_names:
testcases_names.remove('sleep')
+ if not cmp('clean', testcases_names[0]):
+ all_testcases_names += [prev_casename + ":_clean"]
+ continue
+
+ prev_casename = testcases_names[0]
all_testcases_names += testcases_names
+
unique_testcases_names = list(set(all_testcases_names))
# call and initilize proxy component to
diff --git a/mapper.py b/mapper.py
index 4f41230..affc510 100644
--- a/mapper.py
+++ b/mapper.py
@@ -24,20 +24,34 @@ class Mapper(object):
def __init__(self, testcases_list):
self.testcases_list = copy.deepcopy(testcases_list)
- def get_package_tripped(self):
+ def package_casename_func_map(self):
""" Remove the package information to form a new dictionary
"""
tripped_cases_list = []
+ prev_testcasename = ''
+ prev_testcases_params = ''
for testcase in self.testcases_list:
tripped_case = {}
- casename = testcase.keys()[0]
+ testcase_name = testcase.keys()[0]
+ if ":" in testcase_name:
+ casename = testcase_name.split(":")[1]
+ func = casename
- if casename == 'sleep':
+ if testcase_name == 'sleep':
tripped_cases_list.append(testcase)
continue
- testcases_params = testcase.values()[0]
- tripped_case[casename] = testcases_params
+ if testcase_name == 'clean':
+ func = casename + "_clean"
+ tripped_case[prev_testcasename + ":" + func] =
prev_testcases_params
+ tripped_cases_list.append(tripped_case)
+ continue
+ testcases_params = testcase.values()[0]
+ tripped_case[testcase_name + ":" + func] = testcases_params
tripped_cases_list.append(tripped_case)
+
+ prev_testcasename = testcase_name
+ prev_testcases_params = testcases_params
+
return tripped_cases_list
diff --git a/proxy.py b/proxy.py
index a564230..f3664e3 100644
--- a/proxy.py
+++ b/proxy.py
@@ -30,17 +30,22 @@ class Proxy(object):
def get_func_call_dict(self):
for testcase_name in self.testcases_names:
# Get programming package, casename
- package = testcase_name.split(":")[0]
- casename = testcase_name.split(":")[1]
+ elements = testcase_name.split(":")
+ package = elements[0]
+ casename = elements[1]
+ func = casename
+
+ if len(elements) == 3:
+ keyword = elements[2]
+ func = casename + keyword
# Dispatch functions
funcs = getattr(self, "get_call_dict")
func_ref = None
- func = casename
func_ref = funcs(package, casename, func)
# Construct function call dictionary
- key = package + ":" + casename
+ key = package + ":" + casename + ":" + func
self.func_dict[key] = func_ref
return self.func_dict
--
1.7.1