Align damping qualification fixtures and preserve MISRA parameter immutability

This commit is contained in:
Dom
2026-10-26 16:23:24 -05:00
parent 7a38780739
commit 40a23df6be
7 changed files with 20 additions and 13 deletions
@@ -1273,7 +1273,8 @@ static bool hyundai_canfd_angle_aol_capacity(safety_config *ret) {
return bounded;
}
static safety_config hyundai_canfd_init_validated(uint16_t param) {
static safety_config hyundai_canfd_init_validated(uint16_t supplied_param) {
uint16_t param = supplied_param;
const uint16_t HYUNDAI_PARAM_LONGITUDINAL = 4U;
const uint16_t HYUNDAI_PARAM_CANFD_LKA_STEER_MSG_ALT = 128;
const uint16_t HYUNDAI_PARAM_CANFD_ALT_BUTTONS = 32;
@@ -119,7 +119,7 @@ def test_gv70_long_profile_admits_independent_aol():
from opendbc.car.hyundai.tests.test_gv70_longitudinal import params as gv70_params
from openpilot.starpilot.car.hyundai.aol import policy_for
cp = gv70_params()
assert cp.openpilotLongitudinalControl and cp.safetyConfigs[0].safetyParam == 0x15
assert cp.openpilotLongitudinalControl and cp.safetyConfigs[0].safetyParam == 0x2015
policy = policy_for(cp)
assert policy.intent_supported and policy.runtime_supported and policy.explicit_latch
@@ -181,7 +181,8 @@ def test_gv70_long_aol_rejects_unsupported_profile(defect):
cp.safetyConfigs[0].safetyParam |= policy.safety_param_addition
cp.alternativeExperience |= policy.alternative_experience_addition
assert qualified_long(cp, marked_only=True)
assert native_accepts_cp(cp, int(cp.safetyConfigs[0].safetyModel.raw), 0x815)
assert cp.safetyConfigs[0].safetyParam == 0x2815
assert native_accepts_cp(cp, int(cp.safetyConfigs[0].safetyModel.raw), 0x2815)
if defect == 'pcm':
cp.pcmCruise = True
elif defect == 'long':
@@ -498,7 +498,7 @@ int main() {
0x7090U, 0x7092U, 0x7208U, 0x720AU, 0x7228U, 0x722AU, 0x7809U, 0x7829U,
};
for (uint32_t word = 0U; word <= 0xFFFFU; ++word) {
bool expected = word == 0x0815U || word == 0x0895U || word == 0x8815U || word == 0x8895U || word == 0x5491U || word == 0x5C91U || word == 0x5C95U || word == 0x5495U;
bool expected = word == 0x2815U || word == 0x2895U || word == 0x0815U || word == 0x0895U || word == 0x8815U || word == 0x8895U || word == 0x5491U || word == 0x5C91U || word == 0x5C95U || word == 0x5495U;
for (uint16_t stock_word : stock_canfd_words) {
expected = expected || word == stock_word;
}
@@ -18,7 +18,7 @@ def test_selected_gv70_long_owner_preserves_factory_configuration(pandas):
cp.safetyConfigs[-1].safetyParam |= policy.safety_param_addition
cp.alternativeExperience |= policy.alternative_experience_addition
assert qualified_long(cp, marked_only=True) and config_index(cp) == pandas - 1
assert native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x815)
assert native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x2815)
assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.noOutput), 0)
assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x895)
marked = cp.to_dict()
@@ -28,14 +28,18 @@ def test_selected_gv70_long_owner_preserves_factory_configuration(pandas):
assert marked['alternativeExperience'] == 32
@pytest.mark.parametrize('fault', ['aux_word', 'aux_model', 'order', 'extra_slot', 'owner_model', 'owner_word',
@pytest.mark.parametrize('fault', ['missing_damping', 'aux_word', 'aux_model', 'order', 'extra_slot', 'owner_model', 'owner_word',
'experience', 'foreign_identity', 'angle', 'alt_lka', 'alt_buttons', 'camera',
'ccnc', 'hybrid', 'passive', 'dashcam', 'not_car', 'pcm', 'missing_long', 'steer_type'])
def test_two_panda_gv70_long_refuses_unqualified_configuration(fault):
cp, _, _ = factory(CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN)
cp.safetyConfigs[-1].safetyParam = 0x815
cp.safetyConfigs[-1].safetyParam = 0x2815
cp.alternativeExperience = 32
if fault == 'aux_word':
assert qualified_long(cp, marked_only=True)
assert native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x2815)
if fault == 'missing_damping':
cp.safetyConfigs[-1].safetyParam = 0x815
elif fault == 'aux_word':
cp.safetyConfigs[0].safetyParam = 1
elif fault == 'aux_model':
cp.safetyConfigs[0].safetyModel = 'silent'
@@ -46,7 +50,7 @@ def test_two_panda_gv70_long_refuses_unqualified_configuration(fault):
elif fault == 'owner_model':
cp.safetyConfigs[-1].safetyModel = 'hyundai'
elif fault == 'owner_word':
cp.safetyConfigs[-1].safetyParam = 0x895
cp.safetyConfigs[-1].safetyParam = 0x2895
elif fault == 'experience':
cp.alternativeExperience = 0
elif fault == 'foreign_identity':
@@ -68,4 +72,4 @@ def test_two_panda_gv70_long_refuses_unqualified_configuration(fault):
elif fault == 'steer_type':
cp.steerControlType = 'angle'
assert not qualified_long(cp, marked_only=True)
assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x815)
assert not native_accepts_cp(cp, int(structs.CarParams.SafetyModel.hyundaiCanfd), 0x2815)
@@ -112,7 +112,8 @@ class TestEV6Startup(unittest.TestCase):
admission_results and admission_results[0]):
self.assertIs(holder.owner.outcome, Outcome.SENT_UNCONFIRMED)
self.assertTrue(ci.CP.openpilotLongitudinalControl)
self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, 0x15)
self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam,
0x2015 if car == CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN else 0x15)
return ci, holder, requests
def test_sent_prepublication_binds_immutable_template_and_suppressed_protocol(self):
@@ -27,7 +27,7 @@ class TestGV70Startup(unittest.TestCase):
self.assertIs(holder.owner.outcome, Outcome.SENT_UNCONFIRMED)
self.assertIsInstance(ci.CC.adrv_template, GV70Template)
self.assertNotIsInstance(ci.CC.adrv_template, EV6Template)
self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, 0x15)
self.assertEqual(ci.CP.safetyConfigs[-1].safetyParam, 0x2015)
self.assertIn(b'\x28\x83\x01', requests)
self.assertNotIn(b'\x28\x03\x01', requests)
ci.CP.safetyConfigs[-1].safetyParam ^= 4
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "88ebc71e4fd19cdea51fe362738b6641edb5dc03c4f9b4e9f14671c4deff470b", "schema_version": 1}
{"protected_inventory_sha256": "e6f127f6aa4406e96340a814e491f5889c01f4e66213492134703996758d0a87", "schema_version": 1}