Keep schema and caller checks aligned with reviewed source contracts

This commit is contained in:
firestar5683
2026-10-30 02:22:25 -05:00
parent 2cca20624c
commit d955ebd7a2
5 changed files with 164 additions and 9 deletions
+5 -2
View File
@@ -1,7 +1,7 @@
import unittest
from opendbc.car.gm.fingerprints import FINGERPRINTS
from opendbc.car.gm.values import CAMERA_ACC_CAR, NO_ACC_BOLT_CAR, GM_RX_OFFSET
from opendbc.car.gm.values import CAR, CAMERA_ACC_CAR, NO_ACC_BOLT_CAR, GM_RX_OFFSET
from opendbc.testing import parameterized
CAMERA_DIAGNOSTIC_ADDRESS = 0x24b
@@ -15,7 +15,10 @@ class TestGMFingerprint(unittest.TestCase):
assert all(len(finger) for finger in fingerprints)
# The camera can sometimes be communicating on startup
if car_model in CAMERA_ACC_CAR - NO_ACC_BOLT_CAR:
if car_model == CAR.CHEVROLET_TRAX:
from opendbc.car.gm.tests.test_trax_fingerprint import RECORDED
assert fingerprints == [{int(address): size for address, size in RECORDED['bus0'].items()}]
elif car_model in CAMERA_ACC_CAR - NO_ACC_BOLT_CAR:
for finger in fingerprints:
for required_addr in (CAMERA_DIAGNOSTIC_ADDRESS, CAMERA_DIAGNOSTIC_ADDRESS + GM_RX_OFFSET):
assert finger.get(required_addr) == 8, required_addr
@@ -251,7 +251,8 @@ def test_startup_option_preserves_actual_stock_engage_aol_brake_reverse_recovery
original = stock.actual_factory
def selected(*args, **kwargs):
return original(*args, **kwargs, preferences={'SubaruAvhStartup': True, 'SubaruStopStartOff': True})
preferences = {**(kwargs.pop('preferences', None) or {}), 'SubaruAvhStartup': True, 'SubaruStopStartOff': True}
return original(*args, **kwargs, preferences=preferences)
with patch.object(stock, 'actual_factory', side_effect=selected):
stock.test_actual_full_engage_brake_reverse_temporary_recovery_mainoff(CAR.SUBARU_LEGACY_2025, subaru_native_pair, tmp_path)
@@ -230,7 +230,8 @@ def test_startup_option_preserves_actual_stock_engage_aol_brake_reverse_recovery
original = stock.actual_factory
def selected(*args, **kwargs):
return original(*args, **kwargs, preferences={'SubaruStopStartOff': True})
preferences = {**(kwargs.pop('preferences', None) or {}), 'SubaruStopStartOff': True}
return original(*args, **kwargs, preferences=preferences)
with patch.object(stock, 'actual_factory', side_effect=selected):
stock.test_actual_full_engage_brake_reverse_temporary_recovery_mainoff(CAR.SUBARU_LEGACY_2025, subaru_native_pair, tmp_path)
@@ -1,6 +1,6 @@
{
"reviewed_schema_commit": "632fa395624275e900b072309950624d36b0184f",
"reviewed_schema_sha256": "ce728d3074ad43da2f8782cedae4665c118412f5758b011350d747ea6fbb93a0",
"reviewed_schema_commit": "63395a56f1584e81f68556d1fe42c30fc6b3729a",
"reviewed_schema_sha256": "cf1217c26673f2cd0e61f33cee56dc11f5d583dde096c41579fd4d633bdf9e64",
"incumbent_fixture_sha256": "a36ab54c00b5bbe61d520873d24aadfb8f33babd70c31a07046516d5545838d9",
"types": {
"0xf35cc4560bbf6ec2": {
@@ -82,7 +82,7 @@
},
"new_storage": {
"dataWordCount": 18,
"pointerCount": 21,
"pointerCount": 22,
"preferredListEncoding": "inlineComposite",
"isGroup": false,
"discriminantCount": 0,
@@ -196,6 +196,42 @@
"ordinal": {
"explicit": 56
}
},
{
"slot": {
"offset": 33,
"type": {
"float32": null
},
"defaultValue": {
"float32": 0.0
},
"hadExplicitDefault": false
},
"name": "upcomingSpeedLimit",
"codeOrder": 57,
"discriminantValue": 65535,
"ordinal": {
"explicit": 57
}
},
{
"slot": {
"offset": 21,
"type": {
"text": null
},
"defaultValue": {
"text": ""
},
"hadExplicitDefault": false
},
"name": "upcomingBoundaryId",
"codeOrder": 58,
"discriminantValue": 65535,
"ordinal": {
"explicit": 58
}
}
]
},
@@ -380,7 +416,7 @@
},
"new_storage": {
"dataWordCount": 10,
"pointerCount": 3,
"pointerCount": 4,
"preferredListEncoding": "inlineComposite",
"isGroup": false,
"discriminantCount": 0,
@@ -404,6 +440,24 @@
"ordinal": {
"explicit": 14
}
},
{
"slot": {
"offset": 3,
"type": {
"text": null
},
"defaultValue": {
"text": ""
},
"hadExplicitDefault": false
},
"name": "upcomingBoundaryId",
"codeOrder": 15,
"discriminantValue": 65535,
"ordinal": {
"explicit": 15
}
}
]
},
@@ -488,6 +542,102 @@
}
}
]
},
"0xa4f1eb3323f5f582": {
"kind": "struct",
"before_name": "MapdOut",
"after_name": "MapdOut",
"old_field_count": 34,
"old_storage": {
"dataWordCount": 14,
"pointerCount": 6,
"preferredListEncoding": "inlineComposite",
"isGroup": false,
"discriminantCount": 0,
"discriminantOffset": 0
},
"new_storage": {
"dataWordCount": 16,
"pointerCount": 7,
"preferredListEncoding": "inlineComposite",
"isGroup": false,
"discriminantCount": 0,
"discriminantOffset": 0
},
"added_fields": [
{
"slot": {
"offset": 19,
"type": {
"float32": null
},
"defaultValue": {
"float32": 0.0
},
"hadExplicitDefault": false
},
"name": "previewSpeedLimit",
"codeOrder": 34,
"discriminantValue": 65535,
"ordinal": {
"explicit": 34
}
},
{
"slot": {
"offset": 28,
"type": {
"float32": null
},
"defaultValue": {
"float32": 0.0
},
"hadExplicitDefault": false
},
"name": "previewDistance",
"codeOrder": 35,
"discriminantValue": 65535,
"ordinal": {
"explicit": 35
}
},
{
"slot": {
"offset": 6,
"type": {
"text": null
},
"defaultValue": {
"text": ""
},
"hadExplicitDefault": false
},
"name": "previewBoundaryId",
"codeOrder": 36,
"discriminantValue": 65535,
"ordinal": {
"explicit": 36
}
},
{
"slot": {
"offset": 15,
"type": {
"int64": null
},
"defaultValue": {
"int64": 0
},
"hadExplicitDefault": false
},
"name": "previewWayId",
"codeOrder": 37,
"discriminantValue": 65535,
"ordinal": {
"explicit": 37
}
}
]
}
},
"published_addition_commits": {
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "5280e0916346f7ae965b6c57c244669dd57cb1f671a19748e172c5a8cf9e7a2b", "schema_version": 1}
{"protected_inventory_sha256": "f4c3462021efac13f85e5345e482ec5a609255ff737050248c7db79373f1d682", "schema_version": 1}