mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 03:13:44 +08:00
Restore Hyundai Safety Test Fixtures
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
from opendbc.car.structs import CarParams
|
||||
import unittest
|
||||
from opendbc.safety.tests import test_hyundai_kona_lda_aol as fixture
|
||||
|
||||
|
||||
class TestHyundaiClassicLongAol(unittest.TestCase):
|
||||
class ClassicLongAolFixture(fixture.KonaAolFixture):
|
||||
def setUp(self):
|
||||
fixture.TestHyundaiKonaLdaAol.setUp(self)
|
||||
super().setUp()
|
||||
self.release = self.safety.set_safety_hooks(CarParams.SafetyModel.allOutput, 0) != 0
|
||||
|
||||
tearDown = fixture.TestHyundaiKonaLdaAol.tearDown
|
||||
reset = fixture.TestHyundaiKonaLdaAol.reset
|
||||
rx = fixture.TestHyundaiKonaLdaAol.rx
|
||||
request = fixture.TestHyundaiKonaLdaAol.request
|
||||
|
||||
def feed(self, word=0x404, button=0, main=False, available=True, tcs=True, clu=True, wrong_bus=None, corrupt_tcs=False):
|
||||
self.safety.set_timer(self.now)
|
||||
@@ -29,6 +24,8 @@ class TestHyundaiClassicLongAol(unittest.TestCase):
|
||||
self.rx('CLU11', {'CF_Clu_AliveCnt1': c % 16, 'CF_Clu_CruiseSwState': button, 'CF_Clu_CruiseSwMain': int(main)})
|
||||
self.now += 10000
|
||||
|
||||
|
||||
class TestHyundaiClassicLongAol(ClassicLongAolFixture):
|
||||
def test_marked_long_with_foreign_experience_has_no_rx_or_tx_admission(self):
|
||||
for experience in (0, 1, 33):
|
||||
self.safety.set_alternative_experience(experience)
|
||||
@@ -134,14 +131,7 @@ class TestHyundaiClassicLongAol(unittest.TestCase):
|
||||
self.assertEqual(self.request(3), 0)
|
||||
|
||||
|
||||
class TestHyundaiLegacyLongAol(unittest.TestCase):
|
||||
setUp = TestHyundaiClassicLongAol.setUp
|
||||
tearDown = TestHyundaiClassicLongAol.tearDown
|
||||
reset = TestHyundaiClassicLongAol.reset
|
||||
rx = TestHyundaiClassicLongAol.rx
|
||||
request = TestHyundaiClassicLongAol.request
|
||||
feed = TestHyundaiClassicLongAol.feed
|
||||
|
||||
class TestHyundaiLegacyLongAol(ClassicLongAolFixture):
|
||||
def test_legacy_lda_bit_selects_real_physical_source_without_longitudinal_grant(self):
|
||||
for word in (0xE902, 0xE903, 0xE912, 0xE913):
|
||||
for source, signal in (('BCM_PO_11', 'LDA_BTN'), ('CLU13', 'CF_Clu_LdwsLkasSW')):
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
"""Grouped physical main/gas/LDA owners, retaining native common health."""
|
||||
import unittest
|
||||
from opendbc.safety.tests import test_hyundai_kona_lda_aol as kona
|
||||
|
||||
|
||||
class TestHyundaiGroupedNonSccAol(unittest.TestCase):
|
||||
setUp = kona.TestHyundaiKonaLdaAol.setUp
|
||||
tearDown = kona.TestHyundaiKonaLdaAol.tearDown
|
||||
reset = kona.TestHyundaiKonaLdaAol.reset
|
||||
rx = kona.TestHyundaiKonaLdaAol.rx
|
||||
request = kona.TestHyundaiKonaLdaAol.request
|
||||
class TestHyundaiGroupedNonSccAol(kona.KonaAolFixture):
|
||||
def grouped_feed(self, word, main=False, source=None, pressed=False, engagement_source=True):
|
||||
self.safety.set_timer(self.now)
|
||||
count = self.counter
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import unittest
|
||||
|
||||
import pytest
|
||||
|
||||
from opendbc.can import CANPacker
|
||||
@@ -8,12 +6,6 @@ from opendbc.safety.tests.libsafety import libsafety_py
|
||||
from opendbc.safety.tests import test_hyundai_classic_long_aol as classic_fixture
|
||||
|
||||
|
||||
class _ClassicSources(unittest.TestCase):
|
||||
setUp = classic_fixture.TestHyundaiClassicLongAol.setUp
|
||||
feed = classic_fixture.TestHyundaiClassicLongAol.feed
|
||||
rx = classic_fixture.TestHyundaiClassicLongAol.rx
|
||||
|
||||
|
||||
class Sources:
|
||||
def __init__(self, profile):
|
||||
self.profile = profile
|
||||
@@ -22,7 +14,7 @@ class Sources:
|
||||
self.counter = 0
|
||||
self.next_health_tick = 1_000_000
|
||||
if profile == 'elantra':
|
||||
self.classic = _ClassicSources(methodName='runTest')
|
||||
self.classic = classic_fixture.ClassicLongAolFixture(methodName='runTest')
|
||||
self.classic.setUp()
|
||||
word, model = 0x800E, CarParams.SafetyModel.hyundai
|
||||
self.packer = self.classic.packer
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import unittest
|
||||
|
||||
from opendbc.car.structs import CarParams
|
||||
from opendbc.safety.tests import test_hyundai_kona_lda_aol as kona
|
||||
from opendbc.safety.tests.test_hyundai_classic_scc_aol import TestHyundaiClassicSccAol as Shared
|
||||
|
||||
|
||||
class TestNexoStockAol(unittest.TestCase):
|
||||
setUp = Shared.setUp
|
||||
tearDown = Shared.tearDown
|
||||
reset = Shared.reset
|
||||
rx = Shared.rx
|
||||
request = Shared.request
|
||||
|
||||
class TestNexoStockAol(kona.KonaAolFixture):
|
||||
def feed(self, word, *, gas=0, gas_bus=0, omit=False, pressed=False):
|
||||
Shared.feed(self, word, main=True, source='BCM_PO_11', pressed=pressed)
|
||||
if not omit:
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "c13882ca787971dd7680c91b45c4638f0ce20bbf727ce81c9c85a9faeb567969", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "e2a86d07b2fbe2cc22601c17cc04f930a698bec511846f2996525f63c417ac9e", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user