Skip to content

Commit

Permalink
Rename usages in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nworb-cire committed Dec 17, 2024
1 parent be04b67 commit de4ede4
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 56 deletions.
5 changes: 3 additions & 2 deletions tests/hitl/2_health.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import time
import pytest

from opendbc.car.hyundai.values import HyundaiPandaFlags
from panda import Panda


Expand Down Expand Up @@ -36,10 +37,10 @@ def test_hw_type(p):
def test_heartbeat(p, panda_jungle):
panda_jungle.set_ignition(True)
# TODO: add more cases here once the tests aren't super slow
p.set_safety_mode(mode=Panda.SAFETY_HYUNDAI, param=Panda.FLAG_HYUNDAI_LONG)
p.set_safety_mode(mode=Panda.SAFETY_HYUNDAI, param=HyundaiPandaFlags.FLAG_HYUNDAI_LONG)
p.send_heartbeat()
assert p.health()['safety_mode'] == Panda.SAFETY_HYUNDAI
assert p.health()['safety_param'] == Panda.FLAG_HYUNDAI_LONG
assert p.health()['safety_param'] == HyundaiPandaFlags.FLAG_HYUNDAI_LONG

# shouldn't do anything once we're in a car safety mode
p.set_heartbeat_disabled()
Expand Down
6 changes: 4 additions & 2 deletions tests/safety/test_chrysler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
import unittest

from opendbc.car.chrysler.values import ChryslerPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -89,7 +91,7 @@ class TestChryslerRamDTSafety(TestChryslerSafety):
def setUp(self):
self.packer = CANPackerPanda("chrysler_ram_dt_generated")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_CHRYSLER, Panda.FLAG_CHRYSLER_RAM_DT)
self.safety.set_safety_hooks(Panda.SAFETY_CHRYSLER, ChryslerPandaFlags.FLAG_CHRYSLER_RAM_DT)
self.safety.init_tests()

def _speed_msg(self, speed):
Expand All @@ -113,7 +115,7 @@ class TestChryslerRamHDSafety(TestChryslerSafety):
def setUp(self):
self.packer = CANPackerPanda("chrysler_ram_hd_generated")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_CHRYSLER, Panda.FLAG_CHRYSLER_RAM_HD)
self.safety.set_safety_hooks(Panda.SAFETY_CHRYSLER, ChryslerPandaFlags.FLAG_CHRYSLER_RAM_HD)
self.safety.init_tests()

def _speed_msg(self, speed):
Expand Down
7 changes: 4 additions & 3 deletions tests/safety/test_ford.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import unittest

import panda.tests.safety.common as common
from opendbc.car.ford.values import FordPandaFlags

from panda import Panda
from panda.tests.libpanda import libpanda_py
Expand Down Expand Up @@ -381,7 +382,7 @@ class TestFordCANFDStockSafety(TestFordSafetyBase):
def setUp(self):
self.packer = CANPackerPanda("ford_lincoln_base_pt")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_FORD, Panda.FLAG_FORD_CANFD)
self.safety.set_safety_hooks(Panda.SAFETY_FORD, FordPandaFlags.FLAG_FORD_CANFD)
self.safety.init_tests()


Expand Down Expand Up @@ -457,7 +458,7 @@ class TestFordLongitudinalSafety(TestFordLongitudinalSafetyBase):
def setUp(self):
self.packer = CANPackerPanda("ford_lincoln_base_pt")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_FORD, Panda.FLAG_FORD_LONG_CONTROL)
self.safety.set_safety_hooks(Panda.SAFETY_FORD, FordPandaFlags.FLAG_FORD_LONG_CONTROL)
self.safety.init_tests()


Expand All @@ -472,7 +473,7 @@ class TestFordCANFDLongitudinalSafety(TestFordLongitudinalSafetyBase):
def setUp(self):
self.packer = CANPackerPanda("ford_lincoln_base_pt")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_FORD, Panda.FLAG_FORD_LONG_CONTROL | Panda.FLAG_FORD_CANFD)
self.safety.set_safety_hooks(Panda.SAFETY_FORD, FordPandaFlags.FLAG_FORD_LONG_CONTROL | FordPandaFlags.FLAG_FORD_CANFD)
self.safety.init_tests()


Expand Down
6 changes: 4 additions & 2 deletions tests/safety/test_gm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
import unittest

from opendbc.car.gm.values import GMPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -187,7 +189,7 @@ def setUp(self):
self.packer = CANPackerPanda("gm_global_a_powertrain_generated")
self.packer_chassis = CANPackerPanda("gm_global_a_chassis")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_GM, Panda.FLAG_GM_HW_CAM)
self.safety.set_safety_hooks(Panda.SAFETY_GM, GMPandaFlags.FLAG_GM_HW_CAM)
self.safety.init_tests()

def test_buttons(self):
Expand Down Expand Up @@ -219,7 +221,7 @@ def setUp(self):
self.packer = CANPackerPanda("gm_global_a_powertrain_generated")
self.packer_chassis = CANPackerPanda("gm_global_a_chassis")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_GM, Panda.FLAG_GM_HW_CAM | Panda.FLAG_GM_HW_CAM_LONG)
self.safety.set_safety_hooks(Panda.SAFETY_GM, GMPandaFlags.FLAG_GM_HW_CAM | GMPandaFlags.FLAG_GM_HW_CAM_LONG)
self.safety.init_tests()


Expand Down
13 changes: 7 additions & 6 deletions tests/safety/test_honda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import unittest
import numpy as np

from opendbc.car.honda.values import HondaPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -357,7 +358,7 @@ class TestHondaNidecPcmAltSafety(TestHondaNidecPcmSafety):
def setUp(self):
self.packer = CANPackerPanda("acura_ilx_2016_can_generated")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_NIDEC, Panda.FLAG_HONDA_NIDEC_ALT)
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_NIDEC, HondaPandaFlags.FLAG_HONDA_NIDEC_ALT)
self.safety.init_tests()

def _acc_state_msg(self, main_on):
Expand Down Expand Up @@ -422,7 +423,7 @@ class TestHondaBoschAltBrakeSafetyBase(TestHondaBoschSafetyBase):
"""
def setUp(self):
super().setUp()
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_ALT_BRAKE)
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, HondaPandaFlags.FLAG_HONDA_ALT_BRAKE)
self.safety.init_tests()

def _user_brake_msg(self, brake):
Expand Down Expand Up @@ -471,7 +472,7 @@ class TestHondaBoschLongSafety(HondaButtonEnableBase, TestHondaBoschSafetyBase):

def setUp(self):
super().setUp()
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_BOSCH_LONG)
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, HondaPandaFlags.FLAG_HONDA_BOSCH_LONG)
self.safety.init_tests()

def _send_gas_brake_msg(self, gas, accel):
Expand Down Expand Up @@ -531,7 +532,7 @@ class TestHondaBoschRadarlessSafety(HondaPcmEnableBase, TestHondaBoschRadarlessS

def setUp(self):
super().setUp()
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_RADARLESS)
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, HondaPandaFlags.FLAG_HONDA_RADARLESS)
self.safety.init_tests()


Expand All @@ -542,7 +543,7 @@ class TestHondaBoschRadarlessAltBrakeSafety(HondaPcmEnableBase, TestHondaBoschRa

def setUp(self):
super().setUp()
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_RADARLESS | Panda.FLAG_HONDA_ALT_BRAKE)
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, HondaPandaFlags.FLAG_HONDA_RADARLESS | HondaPandaFlags.FLAG_HONDA_ALT_BRAKE)
self.safety.init_tests()


Expand All @@ -556,7 +557,7 @@ class TestHondaBoschRadarlessLongSafety(common.LongitudinalAccelSafetyTest, Hond

def setUp(self):
super().setUp()
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_RADARLESS | Panda.FLAG_HONDA_BOSCH_LONG)
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, HondaPandaFlags.FLAG_HONDA_RADARLESS | HondaPandaFlags.FLAG_HONDA_BOSCH_LONG)
self.safety.init_tests()

def _accel_msg(self, accel):
Expand Down
8 changes: 5 additions & 3 deletions tests/safety/test_hyundai.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
import random
import unittest

from opendbc.car.hyundai.values import HyundaiPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -121,7 +123,7 @@ class TestHyundaiSafetyAltLimits(TestHyundaiSafety):
def setUp(self):
self.packer = CANPackerPanda("hyundai_kia_generic")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI, Panda.FLAG_HYUNDAI_ALT_LIMITS)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI, HyundaiPandaFlags.FLAG_HYUNDAI_ALT_LIMITS)
self.safety.init_tests()


Expand All @@ -132,7 +134,7 @@ class TestHyundaiSafetyCameraSCC(TestHyundaiSafety):
def setUp(self):
self.packer = CANPackerPanda("hyundai_kia_generic")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI, Panda.FLAG_HYUNDAI_CAMERA_SCC)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI, HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC)
self.safety.init_tests()


Expand Down Expand Up @@ -178,7 +180,7 @@ class TestHyundaiLongitudinalSafety(HyundaiLongitudinalBase, TestHyundaiSafety):
def setUp(self):
self.packer = CANPackerPanda("hyundai_kia_generic")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI, Panda.FLAG_HYUNDAI_LONG)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI, HyundaiPandaFlags.FLAG_HYUNDAI_LONG)
self.safety.init_tests()

def _accel_msg(self, accel, aeb_req=False, aeb_decel=0):
Expand Down
44 changes: 23 additions & 21 deletions tests/safety/test_hyundai_canfd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
from parameterized import parameterized_class
import unittest

from opendbc.car.hyundai.values import HyundaiPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -107,27 +109,27 @@ def setUp(self):

@parameterized_class([
# Radar SCC, test with long flag to ensure flag is not respected until it is supported
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 0, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_EV_GAS | Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_HYBRID_GAS | Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 0, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_HYBRID_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
# Camera SCC
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 2, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_EV_GAS | Panda.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_HYBRID_GAS | Panda.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 2, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_HYBRID_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC},
])
class TestHyundaiCanfdHDA1(TestHyundaiCanfdHDA1Base):
pass


@parameterized_class([
# Radar SCC, test with long flag to ensure flag is not respected until it is supported
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 0, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_EV_GAS | Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_HYBRID_GAS | Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 0, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 0, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_HYBRID_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
# Camera SCC
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 2, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_EV_GAS | Panda.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": Panda.FLAG_HYUNDAI_HYBRID_GAS | Panda.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SCC_BUS": 2, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SCC_BUS": 2, "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_HYBRID_GAS | HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC},
])
class TestHyundaiCanfdHDA1AltButtons(TestHyundaiCanfdHDA1Base):

Expand All @@ -136,7 +138,7 @@ class TestHyundaiCanfdHDA1AltButtons(TestHyundaiCanfdHDA1Base):
def setUp(self):
self.packer = CANPackerPanda("hyundai_canfd")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CANFD_ALT_BUTTONS | self.SAFETY_PARAM)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, HyundaiPandaFlags.FLAG_HYUNDAI_CANFD_ALT_BUTTONS | self.SAFETY_PARAM)
self.safety.init_tests()

def _button_msg(self, buttons, main_button=0, bus=1):
Expand Down Expand Up @@ -171,7 +173,7 @@ class TestHyundaiCanfdHDA2EV(TestHyundaiCanfdBase):
def setUp(self):
self.packer = CANPackerPanda("hyundai_canfd")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CANFD_HDA2 | Panda.FLAG_HYUNDAI_EV_GAS)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, HyundaiPandaFlags.FLAG_HYUNDAI_CANFD_HDA2 | HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS)
self.safety.init_tests()


Expand All @@ -191,8 +193,8 @@ class TestHyundaiCanfdHDA2EVAltSteering(TestHyundaiCanfdBase):
def setUp(self):
self.packer = CANPackerPanda("hyundai_canfd")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CANFD_HDA2 | Panda.FLAG_HYUNDAI_EV_GAS |
Panda.FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, HyundaiPandaFlags.FLAG_HYUNDAI_CANFD_HDA2 | HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS |
HyundaiPandaFlags.FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING)
self.safety.init_tests()


Expand All @@ -213,7 +215,7 @@ class TestHyundaiCanfdHDA2LongEV(HyundaiLongitudinalBase, TestHyundaiCanfdHDA2EV
def setUp(self):
self.packer = CANPackerPanda("hyundai_canfd")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CANFD_HDA2 | Panda.FLAG_HYUNDAI_LONG | Panda.FLAG_HYUNDAI_EV_GAS)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, HyundaiPandaFlags.FLAG_HYUNDAI_CANFD_HDA2 | HyundaiPandaFlags.FLAG_HYUNDAI_LONG | HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS)
self.safety.init_tests()

def _accel_msg(self, accel, aeb_req=False, aeb_decel=0):
Expand All @@ -227,9 +229,9 @@ def _accel_msg(self, accel, aeb_req=False, aeb_decel=0):
# Tests HDA1 longitudinal for ICE, hybrid, EV
@parameterized_class([
# Camera SCC is the only supported configuration for HDA1 longitudinal, TODO: allow radar SCC
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG | Panda.FLAG_HYUNDAI_EV_GAS},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SAFETY_PARAM": Panda.FLAG_HYUNDAI_LONG | Panda.FLAG_HYUNDAI_HYBRID_GAS},
{"GAS_MSG": ("ACCELERATOR_BRAKE_ALT", "ACCELERATOR_PEDAL_PRESSED"), "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_LONG},
{"GAS_MSG": ("ACCELERATOR", "ACCELERATOR_PEDAL"), "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_LONG | HyundaiPandaFlags.FLAG_HYUNDAI_EV_GAS},
{"GAS_MSG": ("ACCELERATOR_ALT", "ACCELERATOR_PEDAL"), "SAFETY_PARAM": HyundaiPandaFlags.FLAG_HYUNDAI_LONG | HyundaiPandaFlags.FLAG_HYUNDAI_HYBRID_GAS},
])
class TestHyundaiCanfdHDA1Long(HyundaiLongitudinalBase, TestHyundaiCanfdHDA1Base):

Expand All @@ -253,7 +255,7 @@ def setUpClass(cls):
def setUp(self):
self.packer = CANPackerPanda("hyundai_canfd")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, Panda.FLAG_HYUNDAI_CAMERA_SCC | self.SAFETY_PARAM)
self.safety.set_safety_hooks(Panda.SAFETY_HYUNDAI_CANFD, HyundaiPandaFlags.FLAG_HYUNDAI_CAMERA_SCC | self.SAFETY_PARAM)
self.safety.init_tests()

def _accel_msg(self, accel, aeb_req=False, aeb_decel=0):
Expand Down
4 changes: 3 additions & 1 deletion tests/safety/test_nissan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
import unittest

from opendbc.car.nissan.values import NissanPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -88,7 +90,7 @@ class TestNissanSafetyAltEpsBus(TestNissanSafety):
def setUp(self):
self.packer = CANPackerPanda("nissan_x_trail_2017_generated")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_NISSAN, Panda.FLAG_NISSAN_ALT_EPS_BUS)
self.safety.set_safety_hooks(Panda.SAFETY_NISSAN, NissanPandaFlags.FLAG_NISSAN_ALT_EPS_BUS)
self.safety.init_tests()


Expand Down
8 changes: 5 additions & 3 deletions tests/safety/test_subaru.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
import enum
import unittest

from opendbc.car.subaru.values import SubaruPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -182,17 +184,17 @@ class TestSubaruGen2TorqueSafetyBase(TestSubaruTorqueSafetyBase):


class TestSubaruGen2TorqueStockLongitudinalSafety(TestSubaruStockLongitudinalSafetyBase, TestSubaruGen2TorqueSafetyBase):
FLAGS = Panda.FLAG_SUBARU_GEN2
FLAGS = SubaruPandaFlags.FLAG_SUBARU_GEN2
TX_MSGS = lkas_tx_msgs(SUBARU_ALT_BUS)


class TestSubaruGen1LongitudinalSafety(TestSubaruLongitudinalSafetyBase, TestSubaruTorqueSafetyBase):
FLAGS = Panda.FLAG_SUBARU_LONG
FLAGS = SubaruPandaFlags.FLAG_SUBARU_LONG
TX_MSGS = lkas_tx_msgs(SUBARU_MAIN_BUS) + long_tx_msgs(SUBARU_MAIN_BUS)


class TestSubaruGen2LongitudinalSafety(TestSubaruLongitudinalSafetyBase, TestSubaruGen2TorqueSafetyBase):
FLAGS = Panda.FLAG_SUBARU_LONG | Panda.FLAG_SUBARU_GEN2
FLAGS = SubaruPandaFlags.FLAG_SUBARU_LONG | SubaruPandaFlags.FLAG_SUBARU_GEN2
TX_MSGS = lkas_tx_msgs(SUBARU_ALT_BUS) + long_tx_msgs(SUBARU_ALT_BUS) + gen2_long_additional_tx_msgs()

def _rdbi_msg(self, did: int):
Expand Down
4 changes: 3 additions & 1 deletion tests/safety/test_subaru_preglobal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3
import unittest

from opendbc.car.subaru.values import SubaruPandaFlags
from panda import Panda
from panda.tests.libpanda import libpanda_py
import panda.tests.safety.common as common
Expand Down Expand Up @@ -62,7 +64,7 @@ def _pcm_status_msg(self, enable):


class TestSubaruPreglobalReversedDriverTorqueSafety(TestSubaruPreglobalSafety):
FLAGS = Panda.FLAG_SUBARU_PREGLOBAL_REVERSED_DRIVER_TORQUE
FLAGS = SubaruPandaFlags.FLAG_SUBARU_PREGLOBAL_REVERSED_DRIVER_TORQUE
DBC = "subaru_outback_2019_generated"


Expand Down
Loading

0 comments on commit de4ede4

Please sign in to comment.