From 192f54d05f404158b4802819e1499a9bde590a19 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 14 Dec 2024 23:35:26 -0800 Subject: [PATCH 1/6] CI: just use ./test.sh (#1582) * CI: just use ./test.sh * make sure this works * how much of this is pre-commit * should be good * rm that --- .github/workflows/tests.yml | 36 +++--------------------------------- pyproject.toml | 1 + test.sh | 6 +++++- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b20a6ff64d..db9935cf90 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,12 +6,8 @@ on: - master pull_request: -# TODO: enable this -#env: -# PYTHONWARNINGS: error,default::DeprecationWarning - jobs: - unit-tests: + tests: name: unit tests runs-on: ${{ matrix.os }} strategy: @@ -21,31 +17,5 @@ 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 + - name: run ./test.sh + run: PYTHONPATH=. ./test.sh diff --git a/pyproject.toml b/pyproject.toml index 43c700c7db..8162c9af47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,6 +99,7 @@ ignore = [ "ISC003", "B027", "B024", + "UP031", "NPY002", # new numpy random syntax is worse ] flake8-implicit-str-concat.allow-multiline=false diff --git a/test.sh b/test.sh index c87eebde83..d24f3cef98 100755 --- a/test.sh +++ b/test.sh @@ -16,7 +16,11 @@ source .venv/bin/activate uv run scons -j8 -uv run pre-commit run --all-files + +# TODO: pre-commit is slow; replace it with openpilot's "op lint" +#uv run pre-commit run --all-files +uv run ruff check . + uv run pytest -n8 GREEN='\033[0;32m' From 51f30f69bf5a946429c136af168f3b4bf0f84b40 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 14 Dec 2024 23:37:05 -0800 Subject: [PATCH 2/6] better name --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index db9935cf90..612d3af683 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ on: jobs: tests: - name: unit tests + name: ./test.sh runs-on: ${{ matrix.os }} strategy: fail-fast: false From 15705fb1d7f556feec6d0808a8629386f17428df Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sat, 14 Dec 2024 23:39:55 -0800 Subject: [PATCH 3/6] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e19db75f5..0b6af2f39f 100644 --- a/README.md +++ b/README.md @@ -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. From fd8471dc0d6fbd7ae009ab6d75036667c5b576a5 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 15 Dec 2024 10:14:30 -0800 Subject: [PATCH 4/6] remove test_generator; doesn't make sense now that we're building it in SCons --- .github/workflows/tests.yml | 3 +-- opendbc/dbc/generator/test_generator.py | 22 ---------------------- pyproject.toml | 2 +- test.sh | 11 ++++++++--- 4 files changed, 10 insertions(+), 28 deletions(-) delete mode 100755 opendbc/dbc/generator/test_generator.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 612d3af683..ddbcbc2678 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,5 +17,4 @@ jobs: steps: - uses: commaai/timeout@v1 - uses: actions/checkout@v4 - - name: run ./test.sh - run: PYTHONPATH=. ./test.sh + - run: ./test.sh diff --git a/opendbc/dbc/generator/test_generator.py b/opendbc/dbc/generator/test_generator.py deleted file mode 100755 index 1cfc70128b..0000000000 --- a/opendbc/dbc/generator/test_generator.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 -import os -import filecmp -import tempfile -from opendbc.dbc.generator.generator import create_all, opendbc_root - - -def test_generator(): - with tempfile.TemporaryDirectory() as d: - create_all(d) - - ignore = [f for f in os.listdir(opendbc_root) if not f.endswith('_generated.dbc')] - comp = filecmp.dircmp(opendbc_root, d, ignore=ignore) - - err = "Generated DBC mismatch\n\n" - err += f"Different files: {comp.diff_files}\n\n" - err += "Run opendbc/dbc/generator/generator.py to regenerate DBC files." - assert len(comp.diff_files) == 0, err - - -if __name__ == "__main__": - test_generator() diff --git a/pyproject.toml b/pyproject.toml index 8162c9af47..07ec93a2c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/test.sh b/test.sh index d24f3cef98..3b2b847e6b 100755 --- a/test.sh +++ b/test.sh @@ -4,25 +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 - +# *** 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" From 879a601665c8cc984fa702f71a923271402affbe Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Mon, 16 Dec 2024 20:59:11 +0100 Subject: [PATCH 5/6] Add speed limit control signals for Ioniq PHEV 2020 (#1573) Add SLC signals to ELECT_GEAR message in Hyundai dbc Added `SLC_ON` and `SLC_SET_SPEED` signals to the ELECT_GEAR message. --- opendbc/dbc/hyundai_kia_generic.dbc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opendbc/dbc/hyundai_kia_generic.dbc b/opendbc/dbc/hyundai_kia_generic.dbc index 0ad95f10e1..d8314a45d9 100644 --- a/opendbc/dbc/hyundai_kia_generic.dbc +++ b/opendbc/dbc/hyundai_kia_generic.dbc @@ -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 From 518d2f27140e275fcff27f27a1dc573b7d600734 Mon Sep 17 00:00:00 2001 From: Victor Hooi Date: Tue, 17 Dec 2024 07:05:07 +1100 Subject: [PATCH 6/6] Volkswagen: Adding FW versions for Skoda Octavia vRS MY 18.5 (#1576) * Adding fingerprint for Skoda Octavia vRS MY 18.5 Adding the firmware versions from a Skoda Octavia MY 18.5 to the fingerprints file. The fwdRadar firmware version was already in there - so just adding one for the srs and engine. * forgot eps --------- Co-authored-by: Shane Smiskol --- opendbc/car/volkswagen/fingerprints.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/volkswagen/fingerprints.py b/opendbc/car/volkswagen/fingerprints.py index 83dd2dcbb4..27bfbdf103 100644 --- a/opendbc/car/volkswagen/fingerprints.py +++ b/opendbc/car/volkswagen/fingerprints.py @@ -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', @@ -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', @@ -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',