Skip to content

Commit f685882

Browse files
authored
Merge pull request #2032 from peternewman/rdm-test-cherry-pick
E1.33 RDM Tests and other improvements
2 parents 03f1bcf + 4cf2a58 commit f685882

5 files changed

Lines changed: 34 additions & 21 deletions

File tree

python/ola/RDMConstants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
__author__ = 'nomis52@gmail.com (Simon Newton)'
2121

2222

23+
RDM_MAX_PARAM_DATA_LENGTH = 231
24+
2325
RDM_ZERO_FOOTPRINT_DMX_ADDRESS = 0xFFFF
2426

2527
RDM_MANUFACTURER_PID_MIN = 0x8000
@@ -43,6 +45,8 @@
4345

4446
RDM_MAX_TEST_DATA_PATTERN_LENGTH = 4096
4547

48+
RDM_MAX_SEARCH_DOMAIN_LENGTH = 231
49+
4650

4751
def _ReverseDict(input):
4852
output = {}

tools/rdm/ModelCollector.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ def _HandleDeviceInfo(self, data):
220220
'sensor_count',
221221
'sub_device_count']
222222
for field in fields:
223-
this_device[field] = data[field]
223+
if field in data:
224+
this_device[field] = data[field]
225+
else:
226+
print('Failed to get %s from device info for UID %s'
227+
% (field, self.uid))
224228

225229
this_device['software_versions'][data['software_version']] = {
226230
'languages': [],

tools/rdm/TestCategory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class TestCategory(object):
3434
'DISPLAY_SETTINGS': 'Display Settings',
3535
'CONFIGURATION': 'Configuration',
3636
'CONTROL': 'Control',
37+
'E133_MANAGEMENT': 'E1.33 (RDMnet) Management',
3738
# And others for things that don't quite fit
3839
'CORE': 'Core Functionality',
3940
'ERROR_CONDITIONS': 'Error Conditions',

tools/rdm/TestDefinitions.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
RDM_MANUFACTURER_SD_MAX, RDM_MANUFACTURER_SD_MIN,
2929
RDM_MAX_DOMAIN_NAME_LENGTH,
3030
RDM_MAX_HOSTNAME_LENGTH,
31+
RDM_MAX_SEARCH_DOMAIN_LENGTH,
3132
RDM_MAX_SERIAL_NUMBER_LENGTH,
3233
RDM_MAX_STRING_LENGTH,
3334
RDM_MAX_TEST_DATA_PATTERN_LENGTH,
@@ -8458,11 +8459,14 @@ class AllSubDevicesGetSearchDomain(TestMixins.AllSubDevicesGetMixin,
84588459
PID = 'SEARCH_DOMAIN'
84598460

84608461

8461-
# class GetSearchDomain(TestMixins.,
8462-
# OptionalParameterTestFixture):
8463-
# CATEGORY = TestCategory.
8464-
# PID = 'SEARCH_DOMAIN'
8465-
# TODO(peter): Test get
8462+
class GetSearchDomain(TestMixins.GetStringMixin,
8463+
OptionalParameterTestFixture):
8464+
CATEGORY = TestCategory.E133_MANAGEMENT
8465+
PID = 'SEARCH_DOMAIN'
8466+
EXPECTED_FIELDS = ['search_domain']
8467+
PROVIDES = ['search_domain']
8468+
MAX_LENGTH = RDM_MAX_SEARCH_DOMAIN_LENGTH
8469+
# TODO(Peter): Validate invalid search domains?
84668470

84678471

84688472
class GetSearchDomainWithData(TestMixins.GetWithDataMixin,
@@ -8473,7 +8477,7 @@ class GetSearchDomainWithData(TestMixins.GetWithDataMixin,
84738477

84748478
# class SetSearchDomain(TestMixins.,
84758479
# OptionalParameterTestFixture):
8476-
# CATEGORY = TestCategory.
8480+
# CATEGORY = TestCategory.E133_MANAGEMENT
84778481
# PID = 'SEARCH_DOMAIN'
84788482
# TODO(peter): Test set
84798483

@@ -8484,12 +8488,6 @@ class SetSearchDomainWithNoData(TestMixins.SetWithNoDataMixin,
84848488
PID = 'SEARCH_DOMAIN'
84858489

84868490

8487-
class SetSearchDomainWithExtraData(TestMixins.SetWithDataMixin,
8488-
OptionalParameterTestFixture):
8489-
"""Send a SET SEARCH_DOMAIN command with extra data."""
8490-
PID = 'SEARCH_DOMAIN'
8491-
8492-
84938491
class AllSubDevicesGetBrokerStatus(TestMixins.AllSubDevicesGetMixin,
84948492
OptionalParameterTestFixture):
84958493
"""Send a get BROKER_STATUS to ALL_SUB_DEVICES."""
@@ -8498,7 +8496,7 @@ class AllSubDevicesGetBrokerStatus(TestMixins.AllSubDevicesGetMixin,
84988496

84998497
# class GetBrokerStatus(TestMixins.,
85008498
# OptionalParameterTestFixture):
8501-
# CATEGORY = TestCategory.
8499+
# CATEGORY = TestCategory.E133_MANAGEMENT
85028500
# PID = 'BROKER_STATUS'
85038501
# TODO(peter): Test get
85048502

@@ -8511,7 +8509,7 @@ class GetBrokerStatusWithData(TestMixins.GetWithDataMixin,
85118509

85128510
# class SetBrokerStatus(TestMixins.,
85138511
# OptionalParameterTestFixture):
8514-
# CATEGORY = TestCategory.
8512+
# CATEGORY = TestCategory.E133_MANAGEMENT
85158513
# PID = 'BROKER_STATUS'
85168514
# TODO(peter): Test set
85178515

tools/rdm/list_rdm_tests.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import sys
2525
import textwrap
2626

27+
from ola.RDMConstants import RDM_MAX_PARAM_DATA_LENGTH
28+
2729
from ola import PidStore
2830

2931
__author__ = 'Peter Newman'
@@ -152,20 +154,22 @@ def GetWithExtraData(names, pid, pid_test_base_name, get_size):
152154
print(' """GET %s with more than %d byte%s of data."""' %
153155
(pid.name, get_size, 's' if get_size > 1 else ''))
154156
print(' PID = \'%s\'' % (pid.name))
157+
if get_size >= RDM_MAX_PARAM_DATA_LENGTH:
158+
print((" # TODO(%s): Should we even have this test, get_size is "
159+
"already at least the max PDL!") % (getpass.getuser()))
155160
dummy_data = GenerateDummyData(get_size)
156161
if dummy_data is None:
157162
print((" # DATA = b'foo' # TODO(%s): Specify extra data if this isn't "
158163
"enough.") % (getpass.getuser()))
159-
print(" # Ensure the first %d bytes are sane/valid." % (get_size))
160164
elif dummy_data != 'foo':
161165
# Doesn't match default, explicitly set value
162166
print((" DATA = b'%s' # TODO(%s): Specify extra data if this isn't "
163167
"enough.") % (dummy_data, getpass.getuser()))
164-
print(" # Ensure the first %d bytes are sane/valid." % (get_size))
165168
else:
166169
print((" # DATA = b'%s' # TODO(%s): Specify extra data if this isn't "
167170
"enough.") % (dummy_data, getpass.getuser()))
168-
print(" # Ensure the first %d bytes are sane/valid." % (get_size))
171+
172+
print(" # Ensure the first %d bytes are sane/valid." % (get_size))
169173
print('')
170174
print('')
171175

@@ -279,20 +283,22 @@ def SetWithExtraData(names, pid, pid_test_base_name, set_size):
279283
'OptionalParameterTestFixture'])
280284
print(' """Send a SET %s command with extra data."""' % (pid.name))
281285
print(' PID = \'%s\'' % (pid.name))
286+
if set_size >= RDM_MAX_PARAM_DATA_LENGTH:
287+
print((" # TODO(%s): Should we even have this test, set_size is "
288+
"already at least the max PDL!") % (getpass.getuser()))
282289
dummy_data = GenerateDummyData(set_size)
283290
if dummy_data is None:
284291
print((" # DATA = b'foo' # TODO(%s): Specify extra data if this isn't "
285292
"enough.") % (getpass.getuser()))
286-
print(" # Ensure the first %d bytes are sane/valid." % (set_size))
287293
elif dummy_data != 'foo':
288294
# Doesn't match default, explicitly set value
289295
print((" DATA = b'%s' # TODO(%s): Specify extra data if this isn't "
290296
"enough.") % (dummy_data, getpass.getuser()))
291-
print(" # Ensure the first %d bytes are sane/valid." % (set_size))
292297
else:
293298
print((" # DATA = b'%s' # TODO(%s): Specify extra data if this isn't "
294299
"enough.") % (dummy_data, getpass.getuser()))
295-
print(" # Ensure the first %d bytes are sane/valid." % (set_size))
300+
301+
print(" # Ensure the first %d bytes are sane/valid." % (set_size))
296302
print('')
297303
print('')
298304

0 commit comments

Comments
 (0)