armodel 1.7.7__py3-none-any.whl → 1.7.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- armodel/cli/arxml_dump_cli.py +33 -22
- armodel/cli/arxml_format_cli.py +25 -13
- armodel/models/M2/AUTOSARTemplates/AutosarTopLevelStructure.py +84 -28
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior.py +410 -61
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswInterfaces.py +80 -9
- armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswOverview.py +141 -35
- armodel/models/M2/AUTOSARTemplates/CommonStructure/Implementation.py +10 -8
- armodel/models/M2/AUTOSARTemplates/CommonStructure/InternalBehavior.py +17 -6
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ModeDeclaration.py +38 -3
- armodel/models/M2/AUTOSARTemplates/CommonStructure/ServiceNeeds.py +91 -18
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/BlueprintDedicated/PortPrototypeBlueprint.py +73 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/BlueprintDedicated/__init__.py +0 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/Keyword.py +45 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/StandardizationTemplate/__init__.py +0 -0
- armodel/models/M2/AUTOSARTemplates/CommonStructure/TriggerDeclaration.py +45 -2
- armodel/models/M2/AUTOSARTemplates/ECUCDescriptionTemplate.py +20 -19
- armodel/models/M2/AUTOSARTemplates/EcuResourceTemplate/HwElementCategory.py +59 -0
- armodel/models/M2/AUTOSARTemplates/EcuResourceTemplate/__init__.py +145 -0
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ARPackage.py +243 -156
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/ElementCollection.py +73 -0
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/Identifiable.py +60 -32
- armodel/models/M2/AUTOSARTemplates/GenericStructure/GeneralTemplateClasses/PrimitiveTypes.py +35 -14
- armodel/models/M2/AUTOSARTemplates/GenericStructure/LifeCycles.py +151 -1
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Components/__init__.py +66 -42
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/Composition/__init__.py +1 -0
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/EndToEndProtection.py +13 -6
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/PortInterface/__init__.py +166 -50
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SoftwareComponentDocumentation.py +80 -0
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/AccessCount.py +9 -1
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ModeDeclarationGroup.py +5 -4
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/RTEEvents.py +11 -1
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/ServiceMapping.py +16 -2
- armodel/models/M2/AUTOSARTemplates/SWComponentTemplate/SwcInternalBehavior/__init__.py +9 -1
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/DataMapping.py +167 -5
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/{ECUResourceMapping.py → EcuResourceMapping.py} +4 -3
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Can/CanTopology.py +31 -21
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Ethernet/EthernetFrame.py +5 -3
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Ethernet/EthernetTopology.py +18 -6
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Flexray/FlexrayCommunication.py +76 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Flexray/FlexrayTopology.py +654 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/Fibex4Flexray/__init__.py +0 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/CoreCommunication.py +64 -31
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/CoreTopology.py +158 -40
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Fibex/FibexCore/EcuInstance.py +19 -6
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/InstanceRefs.py +2 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/Transformer/__init__.py +524 -0
- armodel/models/M2/AUTOSARTemplates/SystemTemplate/__init__.py +15 -13
- armodel/models/M2/MSR/DataDictionary/DataDefProperties.py +10 -1
- armodel/models/M2/MSR/Documentation/BlockElements/Figure.py +163 -0
- armodel/models/M2/MSR/Documentation/BlockElements/__init__.py +0 -0
- armodel/models/M2/MSR/Documentation/TextModel/BlockElements/ListElements.py +5 -3
- armodel/models/M2/MSR/Documentation/TextModel/BlockElements/PaginationAndView.py +22 -1
- armodel/models/M2/MSR/Documentation/TextModel/BlockElements/__init__.py +94 -9
- armodel/models/__init__.py +7 -1
- armodel/parser/abstract_arxml_parser.py +39 -32
- armodel/parser/arxml_parser.py +1439 -551
- armodel/parser/file_parser.py +5 -3
- armodel/tests/test_armodel/models/test_ar_package.py +6 -11
- armodel/tests/test_armodel/models/test_port_interface.py +116 -117
- armodel/tests/test_armodel/parser/test_bsw_module_descriiption.py +109 -109
- armodel/tests/test_armodel/parser/test_sw_components.py +301 -28
- armodel/tests/test_armodel/parser/test_system.py +2 -8
- armodel/transformer/__init__.py +0 -0
- armodel/transformer/abstract.py +6 -0
- armodel/transformer/admin_data.py +31 -0
- armodel/writer/abstract_arxml_writer.py +22 -29
- armodel/writer/arxml_writer.py +1500 -526
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/METADATA +61 -1
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/RECORD +73 -57
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/LICENSE +0 -0
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/WHEEL +0 -0
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/entry_points.txt +0 -0
- {armodel-1.7.7.dist-info → armodel-1.7.9.dist-info}/top_level.txt +0 -0
|
@@ -11,11 +11,12 @@ from .... import ARXMLParser, ARXMLWriter
|
|
|
11
11
|
|
|
12
12
|
import logging
|
|
13
13
|
|
|
14
|
+
|
|
14
15
|
class TestBswMD:
|
|
15
16
|
def setup_method(self):
|
|
16
17
|
logger = logging.getLogger()
|
|
17
18
|
formatter = logging.Formatter('[%(levelname)s] : %(message)s')
|
|
18
|
-
logging.basicConfig(format='[%(levelname)s] : %(message)s', level
|
|
19
|
+
logging.basicConfig(format='[%(levelname)s] : %(message)s', level=logging.DEBUG)
|
|
19
20
|
log_file = 'pytest_armodel.log'
|
|
20
21
|
|
|
21
22
|
file_handler = logging.FileHandler(log_file)
|
|
@@ -30,170 +31,169 @@ class TestBswMD:
|
|
|
30
31
|
|
|
31
32
|
def test_ar_packages(self):
|
|
32
33
|
document = AUTOSAR.getInstance()
|
|
33
|
-
root_pkgs = sorted(document.getARPackages(), key
|
|
34
|
-
assert(len(root_pkgs) == 2)
|
|
35
|
-
assert(root_pkgs[0].getShortName() == "AUTOSAR_BswM")
|
|
36
|
-
assert(root_pkgs[1].getShortName() == "EB_BswM_TxDxM1I14R0")
|
|
34
|
+
root_pkgs = sorted(document.getARPackages(), key=lambda pkg: pkg.short_name)
|
|
35
|
+
assert (len(root_pkgs) == 2)
|
|
36
|
+
assert (root_pkgs[0].getShortName() == "AUTOSAR_BswM")
|
|
37
|
+
assert (root_pkgs[1].getShortName() == "EB_BswM_TxDxM1I14R0")
|
|
37
38
|
|
|
38
|
-
root_pkg_0_pkgs = sorted(root_pkgs[0].getARPackages(), key
|
|
39
|
-
assert(len(root_pkg_0_pkgs) == 3)
|
|
39
|
+
root_pkg_0_pkgs = sorted(root_pkgs[0].getARPackages(), key=lambda pkg: pkg.short_name)
|
|
40
|
+
assert (len(root_pkg_0_pkgs) == 3)
|
|
40
41
|
|
|
41
|
-
bsw_module_desc_pkg = root_pkg_0_pkgs[0] # type:ARPackage
|
|
42
|
-
assert(bsw_module_desc_pkg.getShortName() == "BswModuleDescriptions")
|
|
42
|
+
bsw_module_desc_pkg = root_pkg_0_pkgs[0] # type:ARPackage
|
|
43
|
+
assert (bsw_module_desc_pkg.getShortName() == "BswModuleDescriptions")
|
|
43
44
|
|
|
44
45
|
root_pkg_1_pkgs = root_pkgs[1].getARPackages()
|
|
45
|
-
assert(len(root_pkg_1_pkgs) == 1)
|
|
46
|
+
assert (len(root_pkg_1_pkgs) == 1)
|
|
46
47
|
|
|
47
48
|
def test_bsw_module_description(self):
|
|
48
49
|
document = AUTOSAR.getInstance()
|
|
49
50
|
|
|
50
51
|
pkg = document.find("/AUTOSAR_BswM/BswModuleDescriptions") # type: ARPackage
|
|
51
52
|
bsw_module_descs = pkg.getBswModuleDescriptions()
|
|
52
|
-
assert(len(bsw_module_descs) == 1)
|
|
53
|
+
assert (len(bsw_module_descs) == 1)
|
|
53
54
|
|
|
54
55
|
bsw_module_desc = bsw_module_descs[0]
|
|
55
|
-
assert(bsw_module_desc.getShortName() == "BswM")
|
|
56
|
-
assert(bsw_module_desc.moduleId.getText() == "34")
|
|
57
|
-
assert(bsw_module_desc.moduleId.getValue() == 34)
|
|
56
|
+
assert (bsw_module_desc.getShortName() == "BswM")
|
|
57
|
+
assert (bsw_module_desc.moduleId.getText() == "34")
|
|
58
|
+
assert (bsw_module_desc.moduleId.getValue() == 34)
|
|
58
59
|
|
|
59
60
|
# verify the provided entries
|
|
60
|
-
assert(len(bsw_module_desc.implementedEntryRefs) == 2)
|
|
61
|
-
assert(bsw_module_desc.implementedEntryRefs[0].getDest() == "BSW-MODULE-ENTRY")
|
|
62
|
-
assert(bsw_module_desc.implementedEntryRefs[0].getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_Init")
|
|
63
|
-
assert(bsw_module_desc.implementedEntryRefs[1].getDest() == "BSW-MODULE-ENTRY")
|
|
64
|
-
assert(bsw_module_desc.implementedEntryRefs[1].getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
61
|
+
assert (len(bsw_module_desc.implementedEntryRefs) == 2)
|
|
62
|
+
assert (bsw_module_desc.implementedEntryRefs[0].getDest() == "BSW-MODULE-ENTRY")
|
|
63
|
+
assert (bsw_module_desc.implementedEntryRefs[0].getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_Init")
|
|
64
|
+
assert (bsw_module_desc.implementedEntryRefs[1].getDest() == "BSW-MODULE-ENTRY")
|
|
65
|
+
assert (bsw_module_desc.implementedEntryRefs[1].getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
65
66
|
|
|
66
|
-
assert(len(bsw_module_desc.
|
|
67
|
-
behavior = bsw_module_desc.
|
|
68
|
-
assert(behavior.short_name == "InternalBehavior_0")
|
|
67
|
+
assert (len(bsw_module_desc.getInternalBehaviors()) == 1)
|
|
68
|
+
behavior = bsw_module_desc.getInternalBehaviors()[0]
|
|
69
|
+
assert (behavior.short_name == "InternalBehavior_0")
|
|
69
70
|
|
|
70
|
-
assert(len(behavior.getDataTypeMappingRefs()) == 1)
|
|
71
|
+
assert (len(behavior.getDataTypeMappingRefs()) == 1)
|
|
71
72
|
data_type_mapping_ref = behavior.getDataTypeMappingRefs()[0]
|
|
72
|
-
assert(data_type_mapping_ref.getDest() == "DATA-TYPE-MAPPING-SET")
|
|
73
|
-
assert(data_type_mapping_ref.getValue() == "/BswMMode/DataTypeMappingSets/BswMModeMapping")
|
|
73
|
+
assert (data_type_mapping_ref.getDest() == "DATA-TYPE-MAPPING-SET")
|
|
74
|
+
assert (data_type_mapping_ref.getValue() == "/BswMMode/DataTypeMappingSets/BswMModeMapping")
|
|
74
75
|
|
|
75
|
-
assert(len(behavior.getExclusiveAreas()) == 1)
|
|
76
|
-
assert(behavior.getExclusiveAreas()[0].short_name == "SCHM_BSWM_EXCLUSIVE_AREA")
|
|
76
|
+
assert (len(behavior.getExclusiveAreas()) == 1)
|
|
77
|
+
assert (behavior.getExclusiveAreas()[0].short_name == "SCHM_BSWM_EXCLUSIVE_AREA")
|
|
77
78
|
|
|
78
|
-
assert(len(behavior.getBswSchedulableEntities()) == 1)
|
|
79
|
+
assert (len(behavior.getBswSchedulableEntities()) == 1)
|
|
79
80
|
entity = behavior.getBswSchedulableEntities()[0]
|
|
80
|
-
assert(entity.short_name == "BswM_MainFunction")
|
|
81
|
-
assert(entity.minimumStartInterval is not None)
|
|
82
|
-
assert(entity.minimumStartIntervalMs is not None)
|
|
83
|
-
assert(len(entity.getCanEnterExclusiveAreaRefs()) == 1)
|
|
84
|
-
assert(entity.getCanEnterExclusiveAreaRefs()[0].getDest() == "EXCLUSIVE-AREA")
|
|
85
|
-
assert(entity.getCanEnterExclusiveAreaRefs()[0].getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA")
|
|
86
|
-
assert(entity.implementedEntryRef.getDest() == "BSW-MODULE-ENTRY")
|
|
87
|
-
assert(entity.implementedEntryRef.getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
88
|
-
|
|
89
|
-
assert(len(behavior.getBswTimingEvents()) == 1)
|
|
81
|
+
assert (entity.short_name == "BswM_MainFunction")
|
|
82
|
+
assert (entity.minimumStartInterval is not None)
|
|
83
|
+
assert (entity.minimumStartIntervalMs is not None)
|
|
84
|
+
assert (len(entity.getCanEnterExclusiveAreaRefs()) == 1)
|
|
85
|
+
assert (entity.getCanEnterExclusiveAreaRefs()[0].getDest() == "EXCLUSIVE-AREA")
|
|
86
|
+
assert (entity.getCanEnterExclusiveAreaRefs()[0].getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/SCHM_BSWM_EXCLUSIVE_AREA") # noqa E501
|
|
87
|
+
assert (entity.implementedEntryRef.getDest() == "BSW-MODULE-ENTRY")
|
|
88
|
+
assert (entity.implementedEntryRef.getValue() == "/AUTOSAR_BswM/BswModuleEntrys/BswM_MainFunction")
|
|
89
|
+
|
|
90
|
+
assert (len(behavior.getBswTimingEvents()) == 1)
|
|
90
91
|
event = behavior.getBswTimingEvents()[0]
|
|
91
|
-
assert(event.short_name == "TimingEvent_MainFunction")
|
|
92
|
-
assert(event.startsOnEventRef.getDest() == "BSW-SCHEDULABLE-ENTITY")
|
|
93
|
-
assert(event.startsOnEventRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
|
|
94
|
-
assert(event.period.getValue() == 0.02)
|
|
95
|
-
assert(event.period.getText() == "0.02")
|
|
96
|
-
assert(event.periodMs == 20)
|
|
92
|
+
assert (event.short_name == "TimingEvent_MainFunction")
|
|
93
|
+
assert (event.startsOnEventRef.getDest() == "BSW-SCHEDULABLE-ENTITY")
|
|
94
|
+
assert (event.startsOnEventRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
|
|
95
|
+
assert (event.period.getValue() == 0.02)
|
|
96
|
+
assert (event.period.getText() == "0.02")
|
|
97
|
+
assert (event.periodMs == 20)
|
|
97
98
|
|
|
98
99
|
def test_bsw_module_entries(self):
|
|
99
100
|
document = AUTOSAR.getInstance()
|
|
100
101
|
|
|
101
102
|
pkg = document.find("/AUTOSAR_BswM/BswModuleEntrys") # type: ARPackage
|
|
102
|
-
entries = sorted(pkg.getBswModuleEntries(), key=
|
|
103
|
-
assert(len(entries) == 2)
|
|
104
|
-
|
|
105
|
-
assert(entries[0].getShortName() == "BswM_Init")
|
|
106
|
-
assert(entries[0].getServiceId().getValue() == 0)
|
|
107
|
-
assert(entries[0].getIsReentrant().getValue()
|
|
108
|
-
assert(entries[0].getIsSynchronous().getValue()
|
|
109
|
-
assert(entries[0].getCallType().getText() == "REGULAR")
|
|
110
|
-
assert(entries[0].getExecutionContext().getText() == "UNSPECIFIED")
|
|
111
|
-
assert(entries[0].getSwServiceImplPolicy().getText() == "STANDARD")
|
|
112
|
-
|
|
113
|
-
assert(entries[1].getShortName() == "BswM_MainFunction")
|
|
114
|
-
assert(entries[1].getServiceId().getValue() == 3)
|
|
115
|
-
assert(entries[1].getIsReentrant().getValue()
|
|
116
|
-
assert(entries[1].getIsSynchronous().getValue()
|
|
117
|
-
assert(entries[1].getCallType().getText() == "SCHEDULED")
|
|
118
|
-
assert(entries[1].getExecutionContext().getText() == "TASK")
|
|
119
|
-
assert(entries[1].getSwServiceImplPolicy().getText() == "STANDARD")
|
|
103
|
+
entries = sorted(pkg.getBswModuleEntries(), key=lambda entry: entry.short_name)
|
|
104
|
+
assert (len(entries) == 2)
|
|
105
|
+
|
|
106
|
+
assert (entries[0].getShortName() == "BswM_Init")
|
|
107
|
+
assert (entries[0].getServiceId().getValue() == 0)
|
|
108
|
+
assert (entries[0].getIsReentrant().getValue() is False)
|
|
109
|
+
assert (entries[0].getIsSynchronous().getValue() is True)
|
|
110
|
+
assert (entries[0].getCallType().getText() == "REGULAR")
|
|
111
|
+
assert (entries[0].getExecutionContext().getText() == "UNSPECIFIED")
|
|
112
|
+
assert (entries[0].getSwServiceImplPolicy().getText() == "STANDARD")
|
|
113
|
+
|
|
114
|
+
assert (entries[1].getShortName() == "BswM_MainFunction")
|
|
115
|
+
assert (entries[1].getServiceId().getValue() == 3)
|
|
116
|
+
assert (entries[1].getIsReentrant().getValue() is False)
|
|
117
|
+
assert (entries[1].getIsSynchronous().getValue() is True)
|
|
118
|
+
assert (entries[1].getCallType().getText() == "SCHEDULED")
|
|
119
|
+
assert (entries[1].getExecutionContext().getText() == "TASK")
|
|
120
|
+
assert (entries[1].getSwServiceImplPolicy().getText() == "STANDARD")
|
|
120
121
|
|
|
121
122
|
def test_bsw_module_swc_bsw_mapping(self):
|
|
122
123
|
document = AUTOSAR.getInstance()
|
|
123
124
|
|
|
124
125
|
pkg = document.find("/AUTOSAR_BswM/SwcBswMappings") # type: ARPackage
|
|
125
126
|
mappings = pkg.getSwcBswMappings()
|
|
126
|
-
assert(len(mappings) == 1)
|
|
127
|
+
assert (len(mappings) == 1)
|
|
127
128
|
|
|
128
|
-
assert(mappings[0].bswBehaviorRef.getDest() == "BSW-INTERNAL-BEHAVIOR")
|
|
129
|
-
assert(mappings[0].bswBehaviorRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
129
|
+
assert (mappings[0].bswBehaviorRef.getDest() == "BSW-INTERNAL-BEHAVIOR")
|
|
130
|
+
assert (mappings[0].bswBehaviorRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
130
131
|
|
|
131
|
-
assert(len(mappings[0].getRunnableMappings()) == 1)
|
|
132
|
+
assert (len(mappings[0].getRunnableMappings()) == 1)
|
|
132
133
|
runnable_mapping = mappings[0].getRunnableMappings()[0]
|
|
133
|
-
assert(runnable_mapping.getBswEntityRef().getDest() == "BSW-SCHEDULABLE-ENTITY")
|
|
134
|
-
assert(runnable_mapping.getBswEntityRef().getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
|
|
135
|
-
assert(runnable_mapping.getSwcRunnableRef().getDest() == "RUNNABLE-ENTITY")
|
|
136
|
-
assert(runnable_mapping.getSwcRunnableRef().getValue() == "/AUTOSAR_BswM/SwComponentTypes/BswM/BswMInternalBehavior/RES_MainFunction")
|
|
134
|
+
assert (runnable_mapping.getBswEntityRef().getDest() == "BSW-SCHEDULABLE-ENTITY")
|
|
135
|
+
assert (runnable_mapping.getBswEntityRef().getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0/BswM_MainFunction")
|
|
136
|
+
assert (runnable_mapping.getSwcRunnableRef().getDest() == "RUNNABLE-ENTITY")
|
|
137
|
+
assert (runnable_mapping.getSwcRunnableRef().getValue() == "/AUTOSAR_BswM/SwComponentTypes/BswM/BswMInternalBehavior/RES_MainFunction")
|
|
137
138
|
|
|
138
139
|
def test_bsw_module_implementation(self):
|
|
139
140
|
document = AUTOSAR.getInstance()
|
|
140
141
|
|
|
141
142
|
pkg = document.find("/EB_BswM_TxDxM1I14R0/Implementations") # type: ARPackage
|
|
142
|
-
assert(len(pkg.getBswImplementations()) == 1)
|
|
143
|
+
assert (len(pkg.getBswImplementations()) == 1)
|
|
143
144
|
impl = pkg.getBswImplementations()[0]
|
|
144
|
-
assert(impl.short_name == "BswImplementation_0")
|
|
145
|
-
assert(len(impl.getCodeDescriptors()) == 1)
|
|
145
|
+
assert (impl.short_name == "BswImplementation_0")
|
|
146
|
+
assert (len(impl.getCodeDescriptors()) == 1)
|
|
146
147
|
|
|
147
148
|
code_desc = impl.getCodeDescriptors()[0]
|
|
148
|
-
assert(code_desc.short_name == "Files")
|
|
149
|
-
assert(len(code_desc.getArtifactDescriptors()) == 21)
|
|
150
|
-
assert(len(code_desc.getArtifactDescriptors("SWSRC")) == 4)
|
|
151
|
-
assert(len(code_desc.getArtifactDescriptors("SWHDR")) == 15)
|
|
152
|
-
assert(len(code_desc.getArtifactDescriptors("SWMAKE")) == 2)
|
|
149
|
+
assert (code_desc.short_name == "Files")
|
|
150
|
+
assert (len(code_desc.getArtifactDescriptors()) == 21)
|
|
151
|
+
assert (len(code_desc.getArtifactDescriptors("SWSRC")) == 4)
|
|
152
|
+
assert (len(code_desc.getArtifactDescriptors("SWHDR")) == 15)
|
|
153
|
+
assert (len(code_desc.getArtifactDescriptors("SWMAKE")) == 2)
|
|
153
154
|
|
|
154
|
-
artifact_descs = sorted(code_desc.getArtifactDescriptors("SWMAKE"), key
|
|
155
|
-
assert(artifact_descs[0].getShortLabel().getValue() == "make::BswM_defs.mak")
|
|
156
|
-
assert(artifact_descs[0].getCategory().getValue() == "SWMAKE")
|
|
157
|
-
assert(artifact_descs[1].getShortLabel().getValue() == "make::BswM_rules.mak")
|
|
158
|
-
assert(artifact_descs[1].getCategory().getValue() == "SWMAKE")
|
|
155
|
+
artifact_descs = sorted(code_desc.getArtifactDescriptors("SWMAKE"), key=lambda o: o.getShortLabel().getValue()) # type: List[AutosarEngineeringObject] # noqa E501
|
|
156
|
+
assert (artifact_descs[0].getShortLabel().getValue() == "make::BswM_defs.mak")
|
|
157
|
+
assert (artifact_descs[0].getCategory().getValue() == "SWMAKE")
|
|
158
|
+
assert (artifact_descs[1].getShortLabel().getValue() == "make::BswM_rules.mak")
|
|
159
|
+
assert (artifact_descs[1].getCategory().getValue() == "SWMAKE")
|
|
159
160
|
|
|
160
|
-
assert(impl.programmingLanguage.getValue() == "C")
|
|
161
|
+
assert (impl.programmingLanguage.getValue() == "C")
|
|
161
162
|
|
|
162
|
-
assert(impl.resourceConsumption.short_name == "ResourceConsumption")
|
|
163
|
-
assert(len(impl.resourceConsumption.getMemorySections()) == 8)
|
|
163
|
+
assert (impl.resourceConsumption.short_name == "ResourceConsumption")
|
|
164
|
+
assert (len(impl.resourceConsumption.getMemorySections()) == 8)
|
|
164
165
|
|
|
165
166
|
section = impl.resourceConsumption.getMemorySection("CODE")
|
|
166
|
-
assert(section.short_name == "CODE")
|
|
167
|
-
assert(section.alignment
|
|
168
|
-
assert(section.swAddrMethodRef.getDest() == "SW-ADDR-METHOD")
|
|
169
|
-
assert(section.swAddrMethodRef.getValue() == "/AUTOSAR_MemMap/SwAddrMethods/CODE")
|
|
167
|
+
assert (section.short_name == "CODE")
|
|
168
|
+
assert (section.alignment is None)
|
|
169
|
+
assert (section.swAddrMethodRef.getDest() == "SW-ADDR-METHOD")
|
|
170
|
+
assert (section.swAddrMethodRef.getValue() == "/AUTOSAR_MemMap/SwAddrMethods/CODE")
|
|
170
171
|
|
|
171
172
|
section = impl.resourceConsumption.getMemorySection("VAR_NO_INIT_UNSPECIFIED")
|
|
172
|
-
assert(section.short_name == "VAR_NO_INIT_UNSPECIFIED")
|
|
173
|
-
assert(section.alignment.getText() == "UNSPECIFIED")
|
|
174
|
-
assert(section.swAddrMethodRef.getDest() == "SW-ADDR-METHOD")
|
|
175
|
-
assert(section.swAddrMethodRef.getValue() == "/AUTOSAR_MemMap/SwAddrMethods/VAR_NOINIT")
|
|
176
|
-
|
|
177
|
-
assert(impl.vendorId.getValue() == 1)
|
|
178
|
-
assert(impl.swVersion.getValue() == "1.14.1")
|
|
179
|
-
assert(impl.swcBswMappingRef.getDest() == "SWC-BSW-MAPPING")
|
|
180
|
-
assert(impl.swcBswMappingRef.getValue() == "/AUTOSAR_BswM/SwcBswMappings/SwcBswMapping_0")
|
|
181
|
-
assert(impl.arReleaseVersion.getValue() == "4.0.3")
|
|
182
|
-
assert(impl.behaviorRef.getDest() == "BSW-INTERNAL-BEHAVIOR")
|
|
183
|
-
assert(impl.behaviorRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
173
|
+
assert (section.short_name == "VAR_NO_INIT_UNSPECIFIED")
|
|
174
|
+
assert (section.alignment.getText() == "UNSPECIFIED")
|
|
175
|
+
assert (section.swAddrMethodRef.getDest() == "SW-ADDR-METHOD")
|
|
176
|
+
assert (section.swAddrMethodRef.getValue() == "/AUTOSAR_MemMap/SwAddrMethods/VAR_NOINIT")
|
|
177
|
+
|
|
178
|
+
assert (impl.vendorId.getValue() == 1)
|
|
179
|
+
assert (impl.swVersion.getValue() == "1.14.1")
|
|
180
|
+
assert (impl.swcBswMappingRef.getDest() == "SWC-BSW-MAPPING")
|
|
181
|
+
assert (impl.swcBswMappingRef.getValue() == "/AUTOSAR_BswM/SwcBswMappings/SwcBswMapping_0")
|
|
182
|
+
assert (impl.arReleaseVersion.getValue() == "4.0.3")
|
|
183
|
+
assert (impl.behaviorRef.getDest() == "BSW-INTERNAL-BEHAVIOR")
|
|
184
|
+
assert (impl.behaviorRef.getValue() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
184
185
|
|
|
185
186
|
def test_get_implementation(self):
|
|
186
187
|
document = AUTOSAR.getInstance()
|
|
187
188
|
impl = document.getImplementation("/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
188
|
-
assert(impl.getFullName() == "/EB_BswM_TxDxM1I14R0/Implementations/BswImplementation_0")
|
|
189
|
-
assert(isinstance(impl, BswImplementation))
|
|
189
|
+
assert (impl.getFullName() == "/EB_BswM_TxDxM1I14R0/Implementations/BswImplementation_0")
|
|
190
|
+
assert (isinstance(impl, BswImplementation))
|
|
190
191
|
|
|
191
192
|
def test_get_behavior(self):
|
|
192
193
|
document = AUTOSAR.getInstance()
|
|
193
194
|
behavior = document.getBehavior("/EB_BswM_TxDxM1I14R0/Implementations/BswImplementation_0")
|
|
194
|
-
assert(behavior.getFullName() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
195
|
-
assert(isinstance(behavior, BswInternalBehavior))
|
|
196
|
-
|
|
195
|
+
assert (behavior.getFullName() == "/AUTOSAR_BswM/BswModuleDescriptions/BswM/InternalBehavior_0")
|
|
196
|
+
assert (isinstance(behavior, BswInternalBehavior))
|
|
197
197
|
|
|
198
198
|
def test_load_save(self):
|
|
199
199
|
document = AUTOSAR.getInstance()
|
|
@@ -204,7 +204,7 @@ class TestBswMD:
|
|
|
204
204
|
writer = ARXMLWriter()
|
|
205
205
|
writer.save("data/generated.arxml", document)
|
|
206
206
|
|
|
207
|
-
assert(filecmp.cmp("src/armodel/tests/test_files/SoftwareComponents.arxml", "data/generated.arxml", shallow
|
|
207
|
+
assert (filecmp.cmp("src/armodel/tests/test_files/SoftwareComponents.arxml", "data/generated.arxml", shallow=False) is True)
|
|
208
208
|
|
|
209
209
|
def test_bswm_bswmd_arxml_loading_and_saving(self):
|
|
210
210
|
document = AUTOSAR.getInstance()
|
|
@@ -215,4 +215,4 @@ class TestBswMD:
|
|
|
215
215
|
writer = ARXMLWriter()
|
|
216
216
|
writer.save("data/generated_BswM_Bswmd.arxml", document)
|
|
217
217
|
|
|
218
|
-
assert(filecmp.cmp("src/armodel/tests/test_files/BswM_Bswmd.arxml", "data/generated_BswM_Bswmd.arxml", shallow
|
|
218
|
+
assert (filecmp.cmp("src/armodel/tests/test_files/BswM_Bswmd.arxml", "data/generated_BswM_Bswmd.arxml", shallow=False) is True)
|