mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
car interfaces: long running fuzzy test (#29592)
* draft * draft 2 * increase deadline and run * imports * run -> use old-commit-hash: 821cfff56d00b61fc3b4fba12bf0830cdb21ed27
This commit is contained in:
Vendored
+1
@@ -160,6 +160,7 @@ pipeline {
|
||||
sh "scons --clean && scons --no-cache --random -j42"
|
||||
sh "INTERNAL_SEG_CNT=500 INTERNAL_SEG_LIST=selfdrive/car/tests/test_models_segs.txt FILEREADER_CACHE=1 \
|
||||
pytest -n42 --dist=loadscope selfdrive/car/tests/test_models.py"
|
||||
sh "MAX_EXAMPLES=100 pytest -n42 selfdrive/car/tests/test_car_interfaces.py"
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import math
|
||||
import unittest
|
||||
import hypothesis.strategies as st
|
||||
from hypothesis import given, settings
|
||||
from hypothesis import Phase, given, settings
|
||||
import importlib
|
||||
from parameterized import parameterized
|
||||
|
||||
@@ -18,6 +18,8 @@ from openpilot.selfdrive.test.fuzzy_generation import DrawType, FuzzyGenerator
|
||||
|
||||
ALL_ECUS = list({ecu for ecus in FW_VERSIONS.values() for ecu in ecus.keys()})
|
||||
|
||||
MAX_EXAMPLES = int(os.environ.get('MAX_EXAMPLES', '5'))
|
||||
|
||||
|
||||
def get_fuzzy_car_interface_args(draw: DrawType) -> dict:
|
||||
# Fuzzy CAN fingerprints and FW versions to test more states of the CarInterface
|
||||
@@ -45,8 +47,11 @@ class TestCarInterfaces(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
os.environ['NO_RADAR_SLEEP'] = '1'
|
||||
|
||||
# FIXME: Due to the lists used in carParams, Phase.target is very slow and will cause
|
||||
# many generated examples to overrun when max_examples > ~20, don't use it
|
||||
@parameterized.expand([(car,) for car in sorted(all_known_cars())])
|
||||
@settings(max_examples=5)
|
||||
@settings(max_examples=MAX_EXAMPLES, deadline=500,
|
||||
phases=(Phase.reuse, Phase.generate, Phase.shrink))
|
||||
@given(data=st.data())
|
||||
def test_car_interfaces(self, car_name, data):
|
||||
CarInterface, CarController, CarState = interfaces[car_name]
|
||||
|
||||
Reference in New Issue
Block a user