Skip to content

Commit

Permalink
python conformance test: Add flags for provisional and in-progress (p…
Browse files Browse the repository at this point in the history
…roject-chip#30189)

* Add flags for provisional and in-progress

Also remove extra print

* Add the CI weirdness as well

* Remove extra print
  • Loading branch information
cecille authored Nov 5, 2023
1 parent b82bea2 commit eb2f8f6
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/python_testing/TC_DeviceBasicComposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1013,13 +1013,26 @@ def conformance_str(conformance: Callable, feature_map: uint, feature_dict: dict

return f'Conformance: {str(conformance)}, implemented features: {",".join(codes)}'

ignore_in_progress = self.user_params.get("ignore_in_progress", False)
is_ci = self.check_pics('PICS_SDK_CI_ONLY')

ignore_attributes: dict[int, list[int]] = {}
if ignore_in_progress:
# This is a manually curated list of attributes that are in-progress in the SDK, but have landed in the spec
in_progress_attributes = {Clusters.BasicInformation.id: [0x15, 0x016]}
ignore_attributes.update(in_progress_attributes)

if is_ci:
# The network commissioning clusters on the CI select the features on the fly and end up non-conformant
# on these attributes. Production devices should not.
ci_ignore_attributes = {Clusters.NetworkCommissioning.id: [
Clusters.NetworkCommissioning.Attributes.ScanMaxTimeSeconds.attribute_id, Clusters.NetworkCommissioning.Attributes.ConnectMaxTimeSeconds.attribute_id]}
ignore_attributes.update(ci_ignore_attributes)

success = True
# TODO: provisional needs to be an input parameter
allow_provisional = True
allow_provisional = self.user_params.get("allow_provisional", False)
clusters, problems = build_xml_clusters()
self.problems = self.problems + problems
for id in sorted(list(clusters.keys())):
print(f'{id} 0x{id:02x}: {clusters[id].name}')
for endpoint_id, endpoint in self.endpoints_tlv.items():
for cluster_id, cluster in endpoint.items():
if cluster_id not in clusters.keys():
Expand Down Expand Up @@ -1059,6 +1072,8 @@ def conformance_str(conformance: Callable, feature_map: uint, feature_dict: dict

# Attribute conformance checking
for attribute_id, attribute in cluster.items():
if cluster_id in ignore_attributes and attribute_id in ignore_attributes[cluster_id]:
continue
location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=attribute_id)
if attribute_id not in clusters[cluster_id].attributes.keys():
# TODO: Consolidate the range checks with IDM-10.1 once that lands
Expand All @@ -1076,6 +1091,8 @@ def conformance_str(conformance: Callable, feature_map: uint, feature_dict: dict
problem=f'Attribute 0x{attribute_id:02x} is included, but is disallowed by conformance. {conformance_str(xml_attribute.conformance, feature_map, clusters[cluster_id].features)}')
success = False
for attribute_id, xml_attribute in clusters[cluster_id].attributes.items():
if cluster_id in ignore_attributes and attribute_id in ignore_attributes[cluster_id]:
continue
conformance_decision = xml_attribute.conformance(feature_map, attribute_list, all_command_list)
if conformance_decision == ConformanceDecision.MANDATORY and attribute_id not in cluster.keys():
location = AttributePathLocation(endpoint_id=endpoint_id, cluster_id=cluster_id, attribute_id=attribute_id)
Expand Down

0 comments on commit eb2f8f6

Please sign in to comment.