From 86709e78b83c7b91d82ee462549d2ad75cdd6e1c Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Mon, 15 Apr 2024 08:57:06 -0700 Subject: [PATCH] TC-IDM-10.4: Catch feature mask errors and log (#32419) (#32619) * TC-IDM-10.4: Catch feature mask errors and log * Add comment Co-authored-by: C Freeman Co-authored-by: Andrei Litvin --- src/python_testing/TC_pics_checker.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_pics_checker.py b/src/python_testing/TC_pics_checker.py index 6d49142f8f40b2..ad7939df345324 100644 --- a/src/python_testing/TC_pics_checker.py +++ b/src/python_testing/TC_pics_checker.py @@ -159,7 +159,19 @@ def test_TC_IDM_10_4(self): # Codegen in python uses feature masks (0x01, 0x02, 0x04 etc.) # PICS uses the mask bit number (1, 2, 3) # Convert the mask to a bit number so we can check the PICS. - feature_bit = int(math.log2(feature_mask)) + try: + feature_bit = int(math.log2(feature_mask)) + except ValueError: + location = FeaturePathLocation(endpoint_id=self.endpoint_id, + cluster_id=cluster_id, feature_code=str(feature_mask)) + # The feature_mask is from the code generated feature masks, not the features as listed on the + # device. If we get an error here, this is a problem with the codegen or spec, not with the device + # under test. We still want the problem recorded, but this does not indicate a problem on the DUT. + # There are two clusters with known bad features here - RvcRunMode and RvcCleanMode both have a + # feature mask of kNoFeatures and an empty "mask" of 0x0. + self.record_warning("PICS check", location=location, + problem=f"Unable to parse feature mask {feature_mask} from cluster {cluster}") + continue pics = feature_pics(pics_base, feature_bit) if feature_mask & feature_map: required = True