Skip to content

Commit

Permalink
Merge branch 'commaai:master' into brakehold
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreSato authored Dec 17, 2024
2 parents 4bbc696 + 518d2f2 commit c36763a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 62 deletions.
37 changes: 3 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ on:
- master
pull_request:

# TODO: enable this
#env:
# PYTHONWARNINGS: error,default::DeprecationWarning

jobs:
unit-tests:
name: unit tests
tests:
name: ./test.sh
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -21,31 +17,4 @@ jobs:
steps:
- uses: commaai/timeout@v1
- uses: actions/checkout@v4
- name: install uv and dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
# TODO: remove setuptools once https://github.com/cython/cython/issues/5751 is fixed
uv pip install -e .[testing,docs] setuptools
- run: uv run scons -j8
- run: uv run pytest .

static-analysis:
name: static analysis
runs-on: ubuntu-24.04
steps:
- uses: commaai/timeout@v1
- uses: actions/checkout@v4
- name: setup python
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
uv pip install -e . pre-commit
- name: cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- run: uv run pre-commit run --all
- run: ./test.sh
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ Everything you need to know to use, contribute, and extend opendbc are in these
git clone https://github.com/commaai/opendbc.git
cd opendbc

# you probably just want to use this. it's an all-in-one for dependency
# installation, compiling, linting, and tests. it's also what runs in CI
./test.sh

# here are the individual commands it runs
pip3 install -e .[testing,docs] # install dependencies
scons -j8 # build with 8 cores
pytest . # run the tests
pre-commit run --all-files # run the linter
./test.sh # all-in-one for setup, build, lint, and test
```

[`examples/`](examples/) contains small example programs that can read state from the car and control the steering, gas, and brakes.
Expand Down
3 changes: 3 additions & 0 deletions opendbc/car/volkswagen/fingerprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,7 @@
b'\xf1\x8704L906026BS\xf1\x891541',
b'\xf1\x8704L906026BT\xf1\x897612',
b'\xf1\x875G0906259C \xf1\x890002',
b'\xf1\x875G0906259N \xf1\x890003',
],
(Ecu.transmission, 0x7e1, None): [
b'\xf1\x870CW300041L \xf1\x891601',
Expand All @@ -1143,6 +1144,7 @@
b'\xf1\x873Q0959655AQ\xf1\x890200\xf1\x82\r11120011100010312212113100',
b'\xf1\x873Q0959655AS\xf1\x890200\xf1\x82\r11120011100010022212110200',
b'\xf1\x873Q0959655BH\xf1\x890703\xf1\x82\x0e3221003221002105755331052100',
b'\xf1\x873Q0959655BK\xf1\x890703\xf1\x82\x0e3221003221002132755331322100',
b'\xf1\x873Q0959655CM\xf1\x890720\xf1\x82\x0e3221003221002105755331052100',
b'\xf1\x873Q0959655CN\xf1\x890720\xf1\x82\x0e3221003221002105755331052100',
b'\xf1\x875QD959655 \xf1\x890388\xf1\x82\x111101000011110006110411111111119111',
Expand All @@ -1151,6 +1153,7 @@
b'\xf1\x873Q0909144J \xf1\x895063\xf1\x82\x0566A01513A1',
b'\xf1\x875Q0909144AA\xf1\x891081\xf1\x82\x0521T00403A1',
b'\xf1\x875Q0909144AB\xf1\x891082\xf1\x82\x0521T00403A1',
b'\xf1\x873Q0909144L \xf1\x895081\xf1\x82\x0571T01512A1',
b'\xf1\x875Q0909144AB\xf1\x891082\xf1\x82\x0521T00603A1',
b'\xf1\x875Q0909144R \xf1\x891061\xf1\x82\x0516A00604A1',
b'\xf1\x875Q0909144T \xf1\x891072\xf1\x82\x0521T00601A1',
Expand Down
22 changes: 0 additions & 22 deletions opendbc/dbc/generator/test_generator.py

This file was deleted.

4 changes: 3 additions & 1 deletion opendbc/dbc/hyundai_kia_generic.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,9 @@ BO_ 865 ADAS_PRK_11: 8 ADAS_PRK
SG_ PCA_CHECK_SUM : 48|8@1+ (1,0) [0|0] "" Vector__XXX

BO_ 882 ELECT_GEAR: 8 XXX
SG_ Elect_Gear_Shifter : 16|4@1+ (1,0) [0|7] "" CLU
SG_ Elect_Gear_Shifter : 16|4@1+ (1,0) [0|7] "" CLU
SG_ SLC_ON : 31|1@0+ (1,0) [0|1] "" CLU
SG_ SLC_SET_SPEED : 32|8@1+ (1,0) [0|255] "" CLU

BO_ 881 E_EMS11: 8 XXX
SG_ Brake_Pedal_Pos : 0|8@1+ (1,0) [0|127] "" XXX
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ select = [
"E", "F", "W", "PIE", "C4", "ISC", "A", "B",
"NPY", # numpy
"UP", # pyupgrade
"TRY302", "TRY400", "TRY401", # try/excepts
"TRY203", "TRY400", "TRY401", # try/excepts
"RUF008", "RUF100",
"TID251",
"PLR1704",
Expand All @@ -99,6 +99,7 @@ ignore = [
"ISC003",
"B027",
"B024",
"UP031",
"NPY002", # new numpy random syntax is worse
]
flake8-implicit-str-concat.allow-multiline=false
Expand Down
15 changes: 12 additions & 3 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@ set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR

# check if uv is installed
# TODO: why doesn't uv do this?
export PYTHONPATH=$DIR

# *** dependencies install ***
if ! command -v uv &>/dev/null; then
echo "'uv' is not installed. Installing 'uv'..."
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# ensure we're up to date
uv sync --all-extras
source .venv/bin/activate

# *** build ***
uv run scons -j8

uv run pre-commit run --all-files
# *** lint ***
# TODO: pre-commit is slow; replace it with openpilot's "op lint"
#uv run pre-commit run --all-files
uv run ruff check .

# *** test ***
uv run pytest -n8

# *** all done ***
GREEN='\033[0;32m'
NC='\033[0m'
printf "\n${GREEN}All good!${NC} Finished build, lint, and test in ${SECONDS}s\n"

0 comments on commit c36763a

Please sign in to comment.