Skip to content

Commit a3c5d19

Browse files
Conformance: handle "desc" conformances (#30293)
* Conformance: handle "desc" conformances * Restyled by isort --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 2899e70 commit a3c5d19

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/python_testing/spec_parsing_support.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import glob
1919
import logging
2020
import os
21+
import typing
2122
import xml.etree.ElementTree as ElementTree
2223
from copy import deepcopy
2324
from dataclasses import dataclass
@@ -28,7 +29,7 @@
2829
from chip.tlv import uint
2930
from conformance_support import (DEPRECATE_CONFORM, DISALLOW_CONFORM, MANDATORY_CONFORM, OPTIONAL_CONFORM, OTHERWISE_CONFORM,
3031
PROVISIONAL_CONFORM, ConformanceDecision, ConformanceException, ConformanceParseParameters,
31-
feature, or_operation, parse_callable_from_xml)
32+
feature, optional, or_operation, parse_callable_from_xml)
3233
from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, EventPathLocation,
3334
FeaturePathLocation, ProblemNotice, ProblemSeverity)
3435

@@ -296,6 +297,25 @@ def build_xml_clusters() -> tuple[list[XmlCluster], list[ProblemNotice]]:
296297
else:
297298
derived_clusters[name] = new
298299

300+
# There are a few clusters where the conformance columns are listed as desc. These clusters need specific, targeted tests
301+
# to properly assess conformance. Here, we list them as Optional to allow these for the general test. Targeted tests are described below.
302+
# Descriptor - TagList feature - this feature is mandated when the duplicate condition holds for the endpoint. It is tested in DESC-2.2
303+
# Actions cluster - all commands - these need to be listed in the ActionsList attribute to be supported.
304+
# We do not currently have a test for this. Please see https://github.com/CHIP-Specifications/chip-test-plans/issues/3646.
305+
def remove_problem(location: typing.Union[CommandPathLocation, FeaturePathLocation]):
306+
nonlocal problems
307+
problems = [p for p in problems if p.location != location]
308+
309+
descriptor_id = Clusters.Descriptor.id
310+
code = 'TAGLIST'
311+
mask = clusters[descriptor_id].feature_map[code]
312+
clusters[descriptor_id].features[mask].conformance = optional()
313+
remove_problem(FeaturePathLocation(endpoint_id=0, cluster_id=descriptor_id, feature_code=code))
314+
action_id = Clusters.Actions.id
315+
for c in Clusters.ClusterObjects.ALL_ACCEPTED_COMMANDS[action_id]:
316+
clusters[action_id].accepted_commands[c].conformance = optional()
317+
remove_problem(CommandPathLocation(endpoint_id=0, cluster_id=action_id, command_id=c))
318+
299319
# We have the information now about which clusters are derived, so we need to fix them up. Apply first the base cluster,
300320
# then add the specific cluster overtop
301321
for id, c in clusters.items():

0 commit comments

Comments
 (0)