Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pedal2
Browse files Browse the repository at this point in the history
  • Loading branch information
nworb-cire committed Nov 8, 2023
2 parents f6ecaee + fa04f47 commit 6632766
Show file tree
Hide file tree
Showing 207 changed files with 6,673 additions and 3,537 deletions.
30 changes: 9 additions & 21 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: tests
on: [push, pull_request]

on:
push:
branches:
- master
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/master' && github.ref || github.run_id }}-${{ github.event_name }}
Expand Down Expand Up @@ -48,6 +53,8 @@ jobs:
run: ${{ env.RUN }} "ENABLE_SPI=1 scons -j4"
- name: Build with UBSan
run: ${{ env.RUN }} "scons -j4 --ubsan"
- name: Build jungle firmware with FINAL_PROVISIONING support
run: ${{ env.RUN }} "FINAL_PROVISIONING=1 scons -j4 board/jungle"

unit_tests:
name: unit tests
Expand All @@ -61,8 +68,6 @@ jobs:
run: $RUN "scons -j4"
- name: Test communication protocols
run: $RUN "cd tests/usbprotocol && ./test.sh"
- name: Test logging
run: $RUN "cd tests/logging && ./test.sh"

safety:
name: safety
Expand All @@ -76,7 +81,7 @@ jobs:
- name: Build Docker image
run: eval "$BUILD"
- name: Run safety tests
timeout-minutes: 4
timeout-minutes: 5
run: |
${{ env.RUN }} "cd .. && \
scons -c && \
Expand All @@ -85,23 +90,6 @@ jobs:
scons -j$(nproc) ${{ matrix.flags }} && \
tests/safety/test.sh"
safety_replay:
name: safety replay
runs-on: ubuntu-20.04
strategy:
matrix:
flags: ['', '--ubsan']
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: eval "$BUILD"
- name: Run safety replay
run: |
${{ env.RUN }} "scons -j$(nproc) ${{ matrix.flags }} && \
cd tests/safety_replay && \
./test_safety_replay.py"
misra:
name: misra c2012
runs-on: ubuntu-20.04
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.tmp
*.pyc
.*.swp
.*.swo
Expand All @@ -11,7 +12,7 @@ a.out
.#*
dist/
pandacan.egg-info/
board/obj/
obj/
examples/output.csv
.DS_Store
.vscode*
Expand All @@ -21,3 +22,9 @@ nosetests.xml

# CTU info files generated by Cppcheck
*.*.ctu-info

# safety coverage-related files
*.gcda
*.gcno
tests/safety/coverage-out
tests/safety/coverage.info
54 changes: 19 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-ast
- id: check-yaml
- id: check-merge-conflict
- id: check-symlinks
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
hooks:
- id: mypy
additional_dependencies: ['git+https://github.com/numpy/numpy-stubs', 'types-requests', 'types-atomicwrites',
'types-pycurl']
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args:
- --select=F,E112,E113,E304,E501,E502,E701,E702,E703,E71,E72,E731,W191,W6
- --exclude=tests/gmbitbang/*
- --max-line-length=160
- --statistics
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args:
- -rn
- -sn
- -j0
- --disable=C,R,W0613,W0511,W0212,W0201,W0311,W0106,W0603,W0621,W0703,W0719,W1203,W1514,E1136
- --generated-members="usb1.*"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-yaml
- id: check-merge-conflict
- id: check-symlinks
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
- id: mypy
additional_dependencies: ['git+https://github.com/numpy/numpy-stubs', 'types-requests', 'types-atomicwrites',
'types-pycurl']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: ruff
15 changes: 4 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-instal
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"

ENV PANDA_PATH=/tmp/openpilot/panda
ENV OPENPILOT_REF="e276d2a417a5133fb91c93b2ef30df68a7d5f225"
ENV OPENDBC_REF="9ae9fbfe56f79dca66c673a6479751a15ad61780"
ENV OPENPILOT_REF="5690386d8d731c9bebda536a5c71c890f6dfe98c"
ENV OPENDBC_REF="12dd7675c5ab2f49aedb813a79e6131b370b379f"

COPY requirements.txt /tmp/
RUN pyenv install 3.8.10 && \
pyenv global 3.8.10 && \
RUN pyenv install 3.11.4 && \
pyenv global 3.11.4 && \
pyenv rehash && \
pip install --no-cache-dir -r /tmp/requirements.txt

Expand All @@ -80,13 +80,6 @@ RUN cd /tmp && \
rm -rf /tmp/openpilot/panda && \
rm -rf /tmp/tmppilot

RUN cd /tmp/openpilot && \
git clone https://github.com/commaai/panda_jungle.git && \
cd panda_jungle && \
git fetch && \
git checkout 3a791be1f1877a69cf45de16a670992380622297 && \
rm -rf .git/

RUN cd /tmp/openpilot && \
pip install --no-cache-dir -r opendbc/requirements.txt && \
pip install --no-cache-dir --upgrade aenum lru-dict pycurl tenacity atomicwrites serial smbus2
Expand Down
25 changes: 18 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
def docker_run(String step_label, int timeout_mins, String cmd) {
timeout(time: timeout_mins, unit: 'MINUTES') {
sh script: "docker run --rm --privileged \
--env PARTIAL_TESTS=${env.PARTIAL_TESTS} \
--env PYTHONWARNINGS=error \
--volume /dev/bus/usb:/dev/bus/usb \
--volume /var/run/dbus:/var/run/dbus \
Expand Down Expand Up @@ -62,7 +61,6 @@ pipeline {
agent any
environment {
CI = "1"
//PARTIAL_TESTS = "${env.BRANCH_NAME == 'master' ? ' ' : '1'}"
PYTHONWARNINGS= "error"
DOCKER_IMAGE_TAG = "panda:build-${env.GIT_COMMIT}"

Expand All @@ -82,7 +80,8 @@ pipeline {
steps {
phone_steps("panda-dos", [
["build", "scons -j4"],
["flash", "cd tests/ && ./ci_reset_internal_hw.py"],
["flash", "cd tests/ && ./reflash_internal_panda.py"],
["flash jungle", "cd board/jungle && ./flash.py"],
["test", "cd tests/hitl && HW_TYPES=6 pytest --durations=0 [2-7]*.py -k 'not test_send_recv'"],
])
}
Expand All @@ -93,7 +92,8 @@ pipeline {
steps {
phone_steps("panda-tres", [
["build", "scons -j4"],
["flash", "cd tests/ && ./ci_reset_internal_hw.py"],
["flash", "cd tests/ && ./reflash_internal_panda.py"],
["flash jungle", "cd board/jungle && ./flash.py"],
["test", "cd tests/hitl && HW_TYPES=9 pytest --durations=0 2*.py [5-9]*.py"],
])
}
Expand All @@ -114,15 +114,24 @@ pipeline {
}
}
}
stage('prep') {
stage('jungle tests') {
steps {
script {
retry (3) {
docker_run("reset hardware", 3, "python ./tests/ci_reset_hw.py")
docker_run("reset hardware", 3, "python ./tests/hitl/reset_jungles.py")
}
}
}
}
stage('bootkick tests') {
steps {
script {
docker_run("test", 10, "pytest ./tests/som/test_bootkick.py")
}
}
}

/*
stage('pedal tests') {
steps {
script {
Expand All @@ -133,7 +142,8 @@ pipeline {
stage('HITL tests') {
steps {
script {
docker_run("HITL tests", 35, 'PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE="1d0002000c51303136383232 2f002e000c51303136383232" ./tests/hitl/test.sh')
docker_run("parallel tests", 5, 'PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE="1d0002000c51303136383232 2f002e000c51303136383232" ./tests/hitl/run_parallel_tests.sh')
docker_run("serial tests", 9, 'PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE="1d0002000c51303136383232 2f002e000c51303136383232" ./tests/hitl/run_serial_tests.sh')
}
}
}
Expand All @@ -144,6 +154,7 @@ pipeline {
}
}
}
*/
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# Welcome to panda

![panda tests](https://github.com/commaai/panda/workflows/tests/badge.svg)
![panda drivers](https://github.com/commaai/panda/workflows/drivers/badge.svg)

[panda](http://github.com/commaai/panda) is the nicest universal car interface ever.

<a href="https://comma.ai/shop/products/panda-obd-ii-dongle"><img src="https://github.com/commaai/panda/blob/master/panda.png?raw=true"></a>

It supports 3x CAN, 2x LIN, and 1x GMLAN. It also charges a phone. On the computer side, it has USB.

It uses an [STM32F413](http://www.st.com/en/microcontrollers/stm32f413-423.html?querycriteria=productId=LN2004).

![panda tests](https://github.com/commaai/panda/workflows/tests/badge.svg)
![panda drivers](https://github.com/commaai/panda/workflows/drivers/badge.svg)
panda speaks CAN, CAN FD, LIN, and GMLAN. panda supports [STM32F205](https://www.st.com/resource/en/reference_manual/rm0033-stm32f205xx-stm32f207xx-stm32f215xx-and-stm32f217xx-advanced-armbased-32bit-mcus-stmicroelectronics.pdf), [STM32F413](https://www.st.com/resource/en/reference_manual/rm0430-stm32f413423-advanced-armbased-32bit-mcus-stmicroelectronics.pdf), and [STM32H725](https://www.st.com/resource/en/reference_manual/rm0468-stm32h723733-stm32h725735-and-stm32h730-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf).

## Usage

Expand All @@ -21,7 +19,7 @@ sudo apt-get install dfu-util gcc-arm-none-eabi python3-pip libffi-dev git
```bash
# macOS
brew install --cask gcc-arm-embedded
brew install python3 dfu-util gcc@12
brew install python3 dfu-util gcc@13
```

Clone panda repository:
Expand Down Expand Up @@ -84,7 +82,7 @@ As a universal car interface, it should support every reasonable software interf

## Programming

See `board/README.md`
See [`board/README.md`](board/README.md)

## Debugging

Expand Down Expand Up @@ -112,7 +110,7 @@ to ensure that the behavior remains unchanged.
* compiling the code and flashing it through USB.
* receiving, sending, and forwarding CAN messages on all buses, over USB.

In addition, we run the [pylint](https://www.pylint.org/) and [flake8](https://github.com/PyCQA/flake8) linters on all python files within the panda repo.
In addition, we run the [ruff linter](https://github.com/astral-sh/ruff) on all python files within the panda repo.

## Hardware

Expand Down
Loading

0 comments on commit 6632766

Please sign in to comment.