mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 13:53:53 +01:00
test: Configuration errors in config.rsc
This commit is contained in:
1019
tests/common/config_floating_offset.rsc
Normal file
1019
tests/common/config_floating_offset.rsc
Normal file
File diff suppressed because it is too large
Load Diff
309
tests/common/config_overlapping_bits.rsc
Normal file
309
tests/common/config_overlapping_bits.rsc
Normal file
@@ -0,0 +1,309 @@
|
|||||||
|
{
|
||||||
|
"App": {
|
||||||
|
"name": "PiCtory",
|
||||||
|
"version": "2.1.2",
|
||||||
|
"saveTS": "20231031130813",
|
||||||
|
"language": "en",
|
||||||
|
"layout": {
|
||||||
|
"north": {
|
||||||
|
"size": 70,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"size": 257,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false,
|
||||||
|
"children": {
|
||||||
|
"layout1": {
|
||||||
|
"east": {
|
||||||
|
"size": 500,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"size": 70,
|
||||||
|
"initClosed": true,
|
||||||
|
"initHidden": false,
|
||||||
|
"children": {}
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"size": 200,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false,
|
||||||
|
"children": {
|
||||||
|
"layout1": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Summary": {
|
||||||
|
"inpTotal": 77,
|
||||||
|
"outTotal": 26
|
||||||
|
},
|
||||||
|
"Devices": [
|
||||||
|
{
|
||||||
|
"GUID": "8012178a-c632-ac37-6d81-98aae223e268",
|
||||||
|
"id": "device_RevPiConnect4_20230409_1_0_001",
|
||||||
|
"type": "BASE",
|
||||||
|
"productType": "136",
|
||||||
|
"position": "0",
|
||||||
|
"name": "RevPi Connect 4",
|
||||||
|
"bmk": "RevPi Connect 4",
|
||||||
|
"inpVariant": 0,
|
||||||
|
"outVariant": 0,
|
||||||
|
"comment": "This is a RevPi Connect 4 Device",
|
||||||
|
"offset": 0,
|
||||||
|
"inp": {
|
||||||
|
"0": [
|
||||||
|
"RevPiStatus",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"0",
|
||||||
|
true,
|
||||||
|
"0000",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RevPiIOCycle",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0001",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RS485ErrorCnt",
|
||||||
|
"0",
|
||||||
|
"16",
|
||||||
|
"2",
|
||||||
|
false,
|
||||||
|
"0002",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"Core_Temperature",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"4",
|
||||||
|
false,
|
||||||
|
"0003",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"4": [
|
||||||
|
"Core_Frequency",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"5",
|
||||||
|
false,
|
||||||
|
"0004",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"0": [
|
||||||
|
"RevPiOutput",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"6",
|
||||||
|
true,
|
||||||
|
"0005",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RS485ErrorLimit1",
|
||||||
|
"10",
|
||||||
|
"16",
|
||||||
|
"7",
|
||||||
|
false,
|
||||||
|
"0006",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RS485ErrorLimit2",
|
||||||
|
"1000",
|
||||||
|
"16",
|
||||||
|
"9",
|
||||||
|
false,
|
||||||
|
"0007",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"RevPiLED",
|
||||||
|
"0",
|
||||||
|
"16",
|
||||||
|
"11",
|
||||||
|
true,
|
||||||
|
"0008",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mem": {},
|
||||||
|
"extend": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GUID": "fa804e6e-8e80-0ca5-3b96-4ec06bf99ed0",
|
||||||
|
"id": "device_RevPiRO_20231018_1_0_001",
|
||||||
|
"type": "LEFT_RIGHT",
|
||||||
|
"productType": "137",
|
||||||
|
"position": "32",
|
||||||
|
"name": "RevPi RO",
|
||||||
|
"bmk": "RevPi RO",
|
||||||
|
"inpVariant": 0,
|
||||||
|
"outVariant": 0,
|
||||||
|
"comment": "",
|
||||||
|
"offset": 13,
|
||||||
|
"inp": {
|
||||||
|
"0": [
|
||||||
|
"Status",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"0",
|
||||||
|
false,
|
||||||
|
"0000",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"0": [
|
||||||
|
"RelayOutput_1",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0001",
|
||||||
|
"",
|
||||||
|
"0"
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RelayOutput_2",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0002",
|
||||||
|
"",
|
||||||
|
"1"
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RelayOutput_3",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0003",
|
||||||
|
"",
|
||||||
|
"2"
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"RelayOutput_4",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0004",
|
||||||
|
"",
|
||||||
|
"3"
|
||||||
|
],
|
||||||
|
"4": [
|
||||||
|
"RelayOutputPadding_1",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
false,
|
||||||
|
"0009",
|
||||||
|
"",
|
||||||
|
"0"
|
||||||
|
],
|
||||||
|
"5": [
|
||||||
|
"RelayOutputPadding_2",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
false,
|
||||||
|
"0010",
|
||||||
|
"",
|
||||||
|
"1"
|
||||||
|
],
|
||||||
|
"6": [
|
||||||
|
"RelayOutputPadding_3",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
false,
|
||||||
|
"0011",
|
||||||
|
"",
|
||||||
|
"2"
|
||||||
|
],
|
||||||
|
"7": [
|
||||||
|
"RelayOutputPadding_4",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
false,
|
||||||
|
"0012",
|
||||||
|
"",
|
||||||
|
"3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mem": {
|
||||||
|
"0": [
|
||||||
|
"RelayCycleWarningThreshold_1",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"2",
|
||||||
|
false,
|
||||||
|
"0005",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RelayCycleWarningThreshold_2",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"6",
|
||||||
|
false,
|
||||||
|
"0006",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RelayCycleWarningThreshold_3",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"10",
|
||||||
|
false,
|
||||||
|
"0007",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"RelayCycleWarningThreshold_4",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"14",
|
||||||
|
false,
|
||||||
|
"0008",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extend": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Connections": []
|
||||||
|
}
|
||||||
269
tests/common/config_overlapping_bytes.rsc
Normal file
269
tests/common/config_overlapping_bytes.rsc
Normal file
@@ -0,0 +1,269 @@
|
|||||||
|
{
|
||||||
|
"App": {
|
||||||
|
"name": "PiCtory",
|
||||||
|
"version": "2.1.2",
|
||||||
|
"saveTS": "20231031130813",
|
||||||
|
"language": "en",
|
||||||
|
"layout": {
|
||||||
|
"north": {
|
||||||
|
"size": 70,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false
|
||||||
|
},
|
||||||
|
"south": {
|
||||||
|
"size": 257,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false,
|
||||||
|
"children": {
|
||||||
|
"layout1": {
|
||||||
|
"east": {
|
||||||
|
"size": 500,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"east": {
|
||||||
|
"size": 70,
|
||||||
|
"initClosed": true,
|
||||||
|
"initHidden": false,
|
||||||
|
"children": {}
|
||||||
|
},
|
||||||
|
"west": {
|
||||||
|
"size": 200,
|
||||||
|
"initClosed": false,
|
||||||
|
"initHidden": false,
|
||||||
|
"children": {
|
||||||
|
"layout1": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Summary": {
|
||||||
|
"inpTotal": 77,
|
||||||
|
"outTotal": 26
|
||||||
|
},
|
||||||
|
"Devices": [
|
||||||
|
{
|
||||||
|
"GUID": "8012178a-c632-ac37-6d81-98aae223e268",
|
||||||
|
"id": "device_RevPiConnect4_20230409_1_0_001",
|
||||||
|
"type": "BASE",
|
||||||
|
"productType": "136",
|
||||||
|
"position": "0",
|
||||||
|
"name": "RevPi Connect 4",
|
||||||
|
"bmk": "RevPi Connect 4",
|
||||||
|
"inpVariant": 0,
|
||||||
|
"outVariant": 0,
|
||||||
|
"comment": "This is a RevPi Connect 4 Device",
|
||||||
|
"offset": 0,
|
||||||
|
"inp": {
|
||||||
|
"0": [
|
||||||
|
"RevPiStatus",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"0",
|
||||||
|
true,
|
||||||
|
"0000",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RevPiIOCycle",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0001",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RS485ErrorCnt",
|
||||||
|
"0",
|
||||||
|
"16",
|
||||||
|
"2",
|
||||||
|
false,
|
||||||
|
"0002",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"Core_Temperature",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"4",
|
||||||
|
false,
|
||||||
|
"0003",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"4": [
|
||||||
|
"Core_Frequency",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"5",
|
||||||
|
false,
|
||||||
|
"0004",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"0": [
|
||||||
|
"RevPiOutput",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"6",
|
||||||
|
true,
|
||||||
|
"0005",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RS485ErrorLimit1",
|
||||||
|
"10",
|
||||||
|
"16",
|
||||||
|
"7",
|
||||||
|
false,
|
||||||
|
"0006",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RS485ErrorLimit2",
|
||||||
|
"1000",
|
||||||
|
"16",
|
||||||
|
"9",
|
||||||
|
false,
|
||||||
|
"0007",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"RevPiLED",
|
||||||
|
"0",
|
||||||
|
"16",
|
||||||
|
"11",
|
||||||
|
true,
|
||||||
|
"0008",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mem": {},
|
||||||
|
"extend": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"GUID": "fa804e6e-8e80-0ca5-3b96-4ec06bf99ed0",
|
||||||
|
"id": "device_RevPiRO_20231018_1_0_001",
|
||||||
|
"type": "LEFT_RIGHT",
|
||||||
|
"productType": "137",
|
||||||
|
"position": "32",
|
||||||
|
"name": "RevPi RO",
|
||||||
|
"bmk": "RevPi RO",
|
||||||
|
"inpVariant": 0,
|
||||||
|
"outVariant": 0,
|
||||||
|
"comment": "",
|
||||||
|
"offset": 13,
|
||||||
|
"inp": {
|
||||||
|
"0": [
|
||||||
|
"Status",
|
||||||
|
"0",
|
||||||
|
"8",
|
||||||
|
"0",
|
||||||
|
false,
|
||||||
|
"0000",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"out": {
|
||||||
|
"0": [
|
||||||
|
"RelayOutput_1",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0001",
|
||||||
|
"",
|
||||||
|
"0"
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RelayOutput_2",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0002",
|
||||||
|
"",
|
||||||
|
"1"
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RelayOutput_3",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0003",
|
||||||
|
"",
|
||||||
|
"2"
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"RelayOutput_4",
|
||||||
|
"0",
|
||||||
|
"1",
|
||||||
|
"1",
|
||||||
|
true,
|
||||||
|
"0004",
|
||||||
|
"",
|
||||||
|
"3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mem": {
|
||||||
|
"0": [
|
||||||
|
"RelayCycleWarningThreshold_1",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"2",
|
||||||
|
false,
|
||||||
|
"0005",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"1": [
|
||||||
|
"RelayCycleWarningThreshold_2",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"6",
|
||||||
|
false,
|
||||||
|
"0006",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"2": [
|
||||||
|
"RelayCycleWarningThreshold_3",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"10",
|
||||||
|
false,
|
||||||
|
"0007",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"3": [
|
||||||
|
"RelayCycleWarningThreshold_4",
|
||||||
|
"0",
|
||||||
|
"32",
|
||||||
|
"13",
|
||||||
|
false,
|
||||||
|
"0008",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extend": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Connections": []
|
||||||
|
}
|
||||||
25
tests/common/test_config_rsc_bugs.py
Normal file
25
tests/common/test_config_rsc_bugs.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Test errors in config.rsc"""
|
||||||
|
__author__ = "Sven Sager"
|
||||||
|
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||||
|
__license__ = "GPLv2"
|
||||||
|
|
||||||
|
from os.path import dirname
|
||||||
|
|
||||||
|
from tests import TestRevPiModIO
|
||||||
|
|
||||||
|
|
||||||
|
class TestConfigRscBugs(TestRevPiModIO):
|
||||||
|
|
||||||
|
data_dir = dirname(__file__)
|
||||||
|
|
||||||
|
def test_overlapping(self):
|
||||||
|
with self.assertWarnsRegex(Warning, r"RelayOutputPadding_[1-4]"):
|
||||||
|
self.modio(configrsc="config_overlapping_bits.rsc")
|
||||||
|
|
||||||
|
with self.assertWarnsRegex(Warning, r"RelayCycleWarningThreshold_4"):
|
||||||
|
self.modio(configrsc="config_overlapping_bytes.rsc")
|
||||||
|
|
||||||
|
def test_floating_offsets(self):
|
||||||
|
with self.assertWarnsRegex(Warning, r"Offset value 31.5"):
|
||||||
|
self.modio(configrsc="config_floating_offset.rsc")
|
||||||
Reference in New Issue
Block a user