@@ -2517,6 +2517,7 @@ class GetSlotInfo(OptionalParameterTestFixture):
25172517 """Get SLOT_INFO."""
25182518 CATEGORY = TestCategory .DMX_SETUP
25192519 PID = 'SLOT_INFO'
2520+ REQUIRES = ['dmx_footprint' ]
25202521 PROVIDES = ['defined_slots' , 'undefined_definition_slots' ,
25212522 'undefined_type_sec_slots' ]
25222523
@@ -2531,12 +2532,31 @@ def VerifyResult(self, response, fields):
25312532 self .SetProperty ('undefined_type_sec_slots' , [])
25322533 return
25332534
2534- slots = [d ['slot_offset' ] for d in fields ['slots' ]]
2535- self .SetProperty ('defined_slots' , set (slots ))
2535+ slots = {}
2536+ # check for duplicates
2537+ for d in fields ['slots' ]:
2538+ if d ['slot_offset' ] in slots :
2539+ self .AddWarning ('SLOT_INFO contained slot %d more than once' %
2540+ (d ['slot_offset' ]))
2541+ else :
2542+ slots [d ['slot_offset' ]] = d
2543+
2544+ self .SetProperty ('defined_slots' , set (slots .keys ()))
25362545 undefined_definition_slots = []
25372546 undefined_type_sec_slots = []
25382547
2548+ # do more thorough checking of each (non-duplicate) slot
25392549 for slot in fields ['slots' ]:
2550+ if slot ['slot_offset' ] > TestMixins .MAX_DMX_ADDRESS :
2551+ self .AddWarning (
2552+ "SLOT_INFO slot %d has an offset more than %d"
2553+ % (slot ['slot_offset' ], TestMixins .MAX_DMX_ADDRESS ))
2554+ # footprint is 1 based, offset is 0 based
2555+ if slot ['slot_offset' ] >= self .Property ('dmx_footprint' ):
2556+ self .AddWarning (
2557+ "SLOT_INFO slot %d has an offset greater than or equal to the "
2558+ "personality's defined footprint (%d)"
2559+ % (slot ['slot_offset' ], self .Property ('dmx_footprint' )))
25402560 if slot ['slot_type' ] not in RDMConstants .SLOT_TYPE_TO_NAME :
25412561 self .AddWarning ('Unknown slot type %d for slot %d' %
25422562 (slot ['slot_type' ], slot ['slot_offset' ]))
@@ -2554,10 +2574,26 @@ def VerifyResult(self, response, fields):
25542574 undefined_definition_slots .append (slot ['slot_offset' ])
25552575 else :
25562576 # slot_label_id must reference a defined slot
2577+ # we've already validated the offset of the parent slot, so we don't
2578+ # need to check it again here
25572579 if slot ['slot_label_id' ] not in slots :
25582580 self .AddWarning (
25592581 'Slot %d is of type secondary and references an unknown slot %d'
25602582 % (slot ['slot_offset' ], slot ['slot_label_id' ]))
2583+ else :
2584+ # the defined slot must be a primary slot
2585+ # slot exists, so find it
2586+ primary_slot = slots .get (slot ['slot_label_id' ], None )
2587+ # check the type of the parent slot
2588+ if primary_slot is None :
2589+ self .SetBroken ('Failed to find primary slot for %d (%d)'
2590+ % (slot ['slot_offset' ], slot ['slot_label_id' ]))
2591+ elif (primary_slot ['slot_type' ] !=
2592+ RDMConstants .SLOT_TYPES ['ST_PRIMARY' ]):
2593+ self .AddWarning (
2594+ "Slot %d is of type secondary and references slot %d which "
2595+ "isn't a primary slot"
2596+ % (slot ['slot_offset' ], slot ['slot_label_id' ]))
25612597 if slot ['slot_type' ] == RDMConstants .SLOT_TYPES ['ST_SEC_UNDEFINED' ]:
25622598 undefined_type_sec_slots .append (slot ['slot_offset' ])
25632599
@@ -2737,7 +2773,7 @@ class GetDefaultSlotValues(OptionalParameterTestFixture):
27372773 """Get DEFAULT_SLOT_VALUE."""
27382774 CATEGORY = TestCategory .DMX_SETUP
27392775 PID = 'DEFAULT_SLOT_VALUE'
2740- REQUIRES = ['defined_slots' ]
2776+ REQUIRES = ['dmx_footprint' , ' defined_slots' ]
27412777
27422778 def Test (self ):
27432779 self .AddIfGetSupported (self .AckGetResult ())
@@ -2751,17 +2787,31 @@ def VerifyResult(self, response, fields):
27512787 default_slots = set ()
27522788
27532789 for slot in fields ['slot_values' ]:
2790+ if slot ['slot_offset' ] > TestMixins .MAX_DMX_ADDRESS :
2791+ self .AddWarning (
2792+ "DEFAULT_SLOT_VALUE slot %d has an offset more than %d"
2793+ % (slot ['slot_offset' ], TestMixins .MAX_DMX_ADDRESS ))
2794+ # footprint is 1 based, offset is 0 based
2795+ if slot ['slot_offset' ] >= self .Property ('dmx_footprint' ):
2796+ self .AddWarning (
2797+ "SLOT_INFO slot %d has an offset greater than or equal to the "
2798+ "personality's defined footprint (%d)"
2799+ % (slot ['slot_offset' ], self .Property ('dmx_footprint' )))
2800+ if slot ['slot_offset' ] in default_slots :
2801+ self .AddWarning (
2802+ "DEFAULT_SLOT_VALUE contained slot %d more than once" %
2803+ slot ['slot_offset' ])
27542804 if slot ['slot_offset' ] not in defined_slots :
27552805 self .AddWarning (
2756- "DEFAULT_SLOT_VALUE contained slot %d, which wasn't in SLOT_INFO" %
2757- slot ['slot_offset' ])
2806+ "DEFAULT_SLOT_VALUE contained slot %d, which wasn't in SLOT_INFO" %
2807+ slot ['slot_offset' ])
27582808 default_slots .add (slot ['slot_offset' ])
27592809
27602810 for slot_offset in defined_slots :
27612811 if slot_offset not in default_slots :
27622812 self .AddAdvisory (
2763- "SLOT_INFO contained slot %d, which wasn't in DEFAULT_SLOT_VALUE" %
2764- slot_offset )
2813+ "SLOT_INFO contained slot %d, which wasn't in DEFAULT_SLOT_VALUE" %
2814+ slot_offset )
27652815
27662816
27672817class GetDefaultSlotValueWithData (TestMixins .GetWithDataMixin ,
0 commit comments