Copy all keys in parsed ZC files
* Also adding mode_switch_points key to runnables Change-Id: I8819cc817e4bd272bf3f62671cfb619b5d3e5b9d
This commit is contained in:
parent
f939ff9242
commit
6b5b321881
powertrain_build
test_data/zone_controller/test_composition_yaml
tests/zone_controller
@ -141,7 +141,7 @@ class ZCAL(BaseApplication):
|
||||
"""
|
||||
raw = self.read_translation_files(definition)
|
||||
self.composition_spec = {
|
||||
key: raw[key] for key in ("port_interfaces", "data_types", "calls", "diagnostics", "nv-needs") if key in raw
|
||||
key: value for key, value in raw.items() if key not in ["ports"]
|
||||
}
|
||||
ports_info = {}
|
||||
for port_name, port in raw.get("ports", {}).items():
|
||||
|
@ -471,6 +471,7 @@ class CompositionYaml(ProblemLogger):
|
||||
standard_init_function = autosar_prefix + swc_prefix + "VcExtINI"
|
||||
init_function = custom_init_function if custom_init_function is not None else standard_init_function
|
||||
call_dict = self._get_runnable_calls_info()
|
||||
mode_switch_points_dict = self.composition_spec.get("mode_switch_points", {})
|
||||
runnables = self.build_cfg.get_units_raster_cfg()["SampleTimes"]
|
||||
calibration_variables = list(self.cal_class_info["autosar"]["class_info"].keys())
|
||||
swc_content = {init_function: {"type": "INIT", "accesses": calibration_variables}}
|
||||
@ -489,6 +490,8 @@ class CompositionYaml(ProblemLogger):
|
||||
}
|
||||
if call_dict:
|
||||
swc_content[custom_step_function]["calls"] = call_dict
|
||||
if mode_switch_points_dict:
|
||||
swc_content[custom_step_function]["mode_switch_points"] = mode_switch_points_dict
|
||||
return swc_content
|
||||
|
||||
if custom_step_function is not None:
|
||||
@ -505,6 +508,8 @@ class CompositionYaml(ProblemLogger):
|
||||
}
|
||||
if call_dict:
|
||||
swc_content[key]["calls"] = call_dict
|
||||
if mode_switch_points_dict:
|
||||
swc_content[key]["mode_switch_points"] = mode_switch_points_dict
|
||||
|
||||
return swc_content
|
||||
|
||||
|
@ -37,6 +37,39 @@ expected_result = {
|
||||
"ExternalFiles": composition_yaml_setup.base_configuration
|
||||
}
|
||||
|
||||
expected_extra_runnable_keys_result = {
|
||||
"SoftwareComponents": {
|
||||
"testName_SC": {
|
||||
"type": "SWC",
|
||||
"template": "ARTCSC",
|
||||
"asil": "QM",
|
||||
"secure": False,
|
||||
"runnables": {
|
||||
"AR_prefix_VcExtINI": {
|
||||
"type": "INIT",
|
||||
"accesses": composition_yaml_setup.base_accesses
|
||||
},
|
||||
"AR_prefix_testRunnable": {
|
||||
"period": 10,
|
||||
"type": "PERIODIC",
|
||||
"accesses": composition_yaml_setup.base_accesses,
|
||||
"mode_switch_points": ["DummyPort"]
|
||||
},
|
||||
},
|
||||
"diagnostics": {},
|
||||
"nv-needs": {},
|
||||
"static": composition_yaml_setup.base_static,
|
||||
"shared": composition_yaml_setup.base_shared,
|
||||
"ports": {
|
||||
"GlobSignNme": {"direction": "IN", "interface": "PIGlobSignNme"}
|
||||
}
|
||||
}
|
||||
},
|
||||
"DataTypes": composition_yaml_setup.base_data_types,
|
||||
"PortInterfaces": composition_yaml_setup.base_port_interfaces,
|
||||
"ExternalFiles": composition_yaml_setup.base_configuration
|
||||
}
|
||||
|
||||
expected_custom_names_result = {
|
||||
"SoftwareComponents": {
|
||||
"testName_SC": {
|
||||
|
@ -139,6 +139,16 @@ class TestCompositionYaml(unittest.TestCase):
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml.expected_result, result)
|
||||
|
||||
def test_composition_yaml_extra_runnable_keys(self):
|
||||
"""Checking that the dict is generated correctly with extra runnable keys."""
|
||||
self.zc_spec["mode_switch_points"] = ["DummyPort"]
|
||||
self.composition_yaml = CompositionYaml(
|
||||
self.build_cfg, self.zc_spec, self.unit_cfg, self.zc_core, self.zc_dids, self.nvm_def, {}, {}
|
||||
)
|
||||
result = self.composition_yaml.gather_yaml_info()
|
||||
self.assertDictEqual(composition_yaml.expected_extra_runnable_keys_result, result)
|
||||
del self.zc_spec["mode_switch_points"]
|
||||
|
||||
def test_composition_yaml_with_custom_names(self):
|
||||
"""Checking that the dict is generated correctly with custom names."""
|
||||
self.build_cfg.get_composition_config.side_effect = mock_get_composition_config_custom_names
|
||||
|
Loading…
x
Reference in New Issue
Block a user