"""
self.testcase_class = testcase_class
- def regenerate_glob(self, pattern, is_ip6=False, tc_kwargs_list=None):
+ def regenerate_glob(self, pattern, protocol="ip4", tc_kwargs_list=None):
"""Regenerate files matching glob pattern based on arguments.
In the current working directory, find all files matching
:type tc_kwargs_list: list of tuple or None
"""
+ protocol_to_min_framesize = {
+ "ip4": 64,
+ "ip6": 78,
+ "vxlan+ip4": 114
+ }
+
+ def get_suite_id(filename):
+ dash_split = filename.split("-", 1)
+ if len(dash_split[0]) <= 4:
+ # It was something like "2n1l", we need one more split.
+ dash_split = dash_split[1].split("-", 1)
+ return dash_split[1].split(".", 1)[0]
+
def add_testcase(file_out, num, **kwargs):
file_out.write(testcase.generate(num=num, **kwargs))
return num + 1
num = add_testcase(file_out, num, **tc_kwargs)
print "Regenerator starts at {cwd}".format(cwd=getcwd())
- min_framesize = 78 if is_ip6 else 64
- kwargs_list = tc_kwargs_list if tc_kwargs_list is not None else [
+ min_framesize = protocol_to_min_framesize[protocol]
+ kwargs_list = tc_kwargs_list if tc_kwargs_list else [
{"framesize": min_framesize, "phy_cores": 1},
{"framesize": min_framesize, "phy_cores": 2},
{"framesize": min_framesize, "phy_cores": 4},
text = file_in.read()
text_prolog = "".join(text.partition("*** Test Cases ***")[:-1])
# TODO: Make the following work for 2n suites.
- suite_id = filename.split("-", 1)[1].split(".", 1)[0]
+ suite_id = get_suite_id(filename)
print "Regenerating suite_id:", suite_id
testcase = self.testcase_class(suite_id)
with open(filename, "w") as file_out: