Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions tools/rdm/ResponderTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,23 @@ def Stop(self):
self.SetBroken('stop method not defined')

def SetNotRun(self, message=None):
"""Set the state of the test to NOT_RUN and stop further processing."""
"""Set the state of the test to NOT_RUN."""
self._state = TestState.NOT_RUN
if message:
self.LogDebug(' ' + message)
self.Stop()

def SetBroken(self, message):
"""Set the state of the test to BROKEN."""
self.LogDebug(' Broken: %s' % message)
self._state = TestState.BROKEN

def SetFailed(self, message):
"""Set the state of the test to FAILED."""
self.LogDebug(' Failed: %s' % message)
self._state = TestState.FAILED

def SetPassed(self):
"""Set the state of the test to PASSED."""
self._state = TestState.PASSED


Expand Down Expand Up @@ -303,6 +305,26 @@ def Stop(self):
self._should_run_wrapper = False
self._wrapper.Stop()

def SetNotRun(self, message=None):
"""Set the state of the test to NOT_RUN and stop further processing."""
super(ResponderTestFixture, self).SetNotRun(message)
self.Stop()

def SetBroken(self, message):
"""Set the state of the test to BROKEN and stop further processing."""
super(ResponderTestFixture, self).SetBroken(message)
self.Stop()

def SetFailed(self, message):
"""Set the state of the test to FAILED and stop further processing."""
super(ResponderTestFixture, self).SetFailed(message)
self.Stop()

def SetPassed(self):
"""Set the state of the test to PASSED and stop further processing."""
super(ResponderTestFixture, self).SetPassed()
self.Stop()

def AddExpectedResults(self, results):
"""Add a set of expected results."""
if isinstance(results, list):
Expand Down
39 changes: 21 additions & 18 deletions tools/rdm/TestDefinitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def Test(self):
self.SetProperty(self.PROVIDES[0], True)
if not (self.Property('mute_supported')):
self.SetNotRun('RDM Controller does not support DISCOVERY commands')
self.Stop()
return

self.AddExpectedResults([
Expand Down Expand Up @@ -831,7 +830,12 @@ def VerifyResult(self, response, fields):
(','.join(supported_pids), ','.join(unsupported_pids)))

for p, dependent_pids in self.PID_DEPENDENCIES:
if self.LookupPid(p).value not in supported_parameters:
pid = self.LookupPid(p)
if pid is None:
self.SetBroken('Failed to lookup info for PID %s' % p)
return

if pid.value not in supported_parameters:
continue

unsupported_pids = []
Expand Down Expand Up @@ -952,7 +956,7 @@ def _CheckForConsistency(self):
mandatory_pids = set(self.LookupPid(p).value for p in self.MANDATORY_PIDS)
missing_pids = mandatory_pids - supported_pids
if missing_pids:
self.SetFailed("Missing PIDs %s from sub device's supported pid list" %
self.SetFailed("Missing PIDs %s from sub device's supported pid list " %
', '.join('0x%04hx' % p for p in missing_pids))
return

Expand Down Expand Up @@ -989,7 +993,6 @@ def _CheckForSubDevice(self):
if self._current_index >= PidStore.MAX_VALID_SUB_DEVICE:
self.SetFailed('Only found %d of %d sub devices' %
(len(self._sub_device_addresses), self._device_count))
self.Stop()
return

self.AddExpectedResults([
Expand All @@ -1008,7 +1011,6 @@ def VerifyResult(self, response, fields):
' but the root device reported %s. See section 10.5.1' %
(self._current_index, fields['sub_device_count'],
self._device_count))
self.Stop()
self._sub_device_addresses[self._current_index] = (
fields['dmx_start_address'])
self._sub_device_footprints[self._current_index] = fields['dmx_footprint']
Expand Down Expand Up @@ -1142,7 +1144,7 @@ def Test(self):
self.NackGetResult(RDMNack.NR_UNKNOWN_PID),
self.NackGetResult(
RDMNack.NR_DATA_OUT_OF_RANGE,
advisory='Parameter Description appears to be supported but no'
advisory='Parameter Description appears to be supported but no '
'manufacturer PIDs were declared'),
]
if self.Property('manufacturer_parameters'):
Expand Down Expand Up @@ -1691,7 +1693,6 @@ class SetUnsupportedLanguage(OptionalParameterTestFixture):
def Test(self):
if 'zz' in self.Property('languages_capabilities'):
self.SetBroken('zz exists in the list of available languages')
self.Stop()
return

self.AddIfSetSupported([
Expand Down Expand Up @@ -2092,7 +2093,6 @@ def _GetPersonality(self):
if self._current_index >= MAX_PERSONALITY_NUMBER:
# This should never happen because personality_count is a uint8
self.SetFailed('Could not find all personalities')
self.Stop()
return

self.AddIfGetSupported(self.AckGetResult(
Expand Down Expand Up @@ -2585,7 +2585,7 @@ def VerifyResult(self, response, fields):

for slot in fields['slot_values']:
if slot['slot_offset'] not in defined_slots:
self.AddAdvisory(
self.AddWarning(
"DEFAULT_SLOT_VALUE contained slot %d, which wasn't in SLOT_INFO" %
slot['slot_offset'])
default_slots.add(slot['slot_offset'])
Expand Down Expand Up @@ -2651,7 +2651,6 @@ def Test(self):
self.CheckConsistency('RECORD_SENSORS',
self.Property('sensor_recording_supported'))
self.SetPassed()
self.Stop()


# Sensor Definition
Expand Down Expand Up @@ -2820,6 +2819,12 @@ class SetSensorDefinition(TestMixins.UnsupportedSetMixin,
PID = 'SENSOR_DEFINITION'


class SetSensorDefinitionWithData(TestMixins.UnsupportedSetWithDataMixin,
OptionalParameterTestFixture):
"""Attempt to SET SENSOR_DEFINITION with data."""
PID = 'SENSOR_DEFINITION'


class AllSubDevicesGetSensorDefinition(TestMixins.AllSubDevicesGetMixin,
OptionalParameterTestFixture):
"""Send a Get SENSOR_DEFINITION to ALL_SUB_DEVICES."""
Expand Down Expand Up @@ -3070,14 +3075,14 @@ class ResetUndefinedSensorValues(TestMixins.SetUndefinedSensorValues,
REQUIRES = ['sensor_definitions']


class ResetSensorValueWithNoData(TestMixins.SetWithNoDataMixin,
class SetSensorValueWithNoData(TestMixins.SetWithNoDataMixin,
OptionalParameterTestFixture):
"""SET sensor value without any sensor number."""
PID = 'SENSOR_VALUE'
ALLOWED_NACKS = [RDMNack.NR_UNSUPPORTED_COMMAND_CLASS]


class ResetSensorValueWithExtraData(TestMixins.SetWithDataMixin,
class SetSensorValueWithExtraData(TestMixins.SetWithDataMixin,
OptionalParameterTestFixture):
"""Send a SET SENSOR_VALUE command with extra data."""
PID = 'SENSOR_VALUE'
Expand Down Expand Up @@ -3175,13 +3180,13 @@ class RecordUndefinedSensorValues(TestMixins.SetUndefinedSensorValues,
REQUIRES = ['sensor_definitions']


class RecordSensorValueWithNoData(TestMixins.SetWithNoDataMixin,
OptionalParameterTestFixture):
class SetRecordSensorsWithNoData(TestMixins.SetWithNoDataMixin,
OptionalParameterTestFixture):
"""SET record sensors without any sensor number."""
PID = 'RECORD_SENSORS'


class RecordSensorValueWithExtraData(TestMixins.SetWithDataMixin,
class SetRecordSensorsWithExtraData(TestMixins.SetWithDataMixin,
OptionalParameterTestFixture):
"""Send a SET RECORD_SENSORS command with extra data."""
PID = 'RECORD_SENSORS'
Expand Down Expand Up @@ -4556,7 +4561,7 @@ def CheckForContiguousSubDevices(self):
return True


class CheckBlockAddressConsistency(OptionalParameterTestFixture):
class CheckDMXBlockAddressConsistency(OptionalParameterTestFixture):
"""Check that the device has subdevices if DMX_BLOCK_ADDRESS is supported."""
CATEGORY = TestCategory.CONTROL
REQUIRES = ['sub_device_count']
Expand All @@ -4566,7 +4571,6 @@ def Test(self):
if (self.PidSupported() and self.Property('sub_device_count') == 0):
self.AddAdvisory('DMX_BLOCK_ADDRESS supported but sub device count was 0')
self.SetPassed()
self.Stop()


class GetDMXBlockAddressWithData(TestMixins.GetWithDataMixin,
Expand Down Expand Up @@ -6661,7 +6665,6 @@ def VerifyResult(self, response, fields):
if fields['scene_number'] != self.index:
self.SetFailed('Scene number mismatch, expected %d, got %d' %
(self.index, fields['scene_number']))
self.Stop()

if fields['programmed'] == self.NOT_PROGRAMMED:
# Assume that NOT_PROGRAMMED means that it's writable.
Expand Down