Skip to content

Commit b0b7a76

Browse files
author
Vehicle Researcher
committed
Squashed 'panda/' content from commit 3b35621
git-subtree-dir: panda git-subtree-split: 3b35621
0 parents  commit b0b7a76

File tree

370 files changed

+70350
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

370 files changed

+70350
-0
lines changed

.circleci/config.yml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: 2
2+
jobs:
3+
safety:
4+
machine:
5+
docker_layer_caching: true
6+
steps:
7+
- checkout
8+
- run:
9+
name: Build image
10+
command: "docker build -t panda_safety -f tests/safety/Dockerfile ."
11+
- run:
12+
name: Run safety test
13+
command: |
14+
docker run panda_safety /bin/bash -c "cd /panda/tests/safety; PYTHONPATH=/ ./test.sh"
15+
16+
misra-c2012:
17+
machine:
18+
docker_layer_caching: true
19+
steps:
20+
- checkout
21+
- run:
22+
name: Build image
23+
command: "docker build -t panda_misra -f tests/misra/Dockerfile ."
24+
- run:
25+
name: Run Misra C 2012 test
26+
command: |
27+
mkdir /tmp/misra
28+
docker run -v /tmp/misra:/tmp/misra panda_misra /bin/bash -c "cd /panda/tests/misra; ./test_misra.sh"
29+
- store_artifacts:
30+
name: Store cppcheck test output
31+
path: /tmp/misra/cppcheck_output.txt
32+
- store_artifacts:
33+
name: Store misra test output
34+
path: /tmp/misra/misra_output.txt
35+
36+
build:
37+
machine:
38+
docker_layer_caching: true
39+
steps:
40+
- checkout
41+
- run:
42+
name: Build image
43+
command: "docker build -t panda_build -f tests/build/Dockerfile ."
44+
- run:
45+
name: Test python package installer
46+
command: |
47+
docker run panda_build /bin/bash -c "cd /panda; python setup.py install"
48+
- run:
49+
name: Build Panda STM image
50+
command: |
51+
docker run panda_build /bin/bash -c "cd /panda/board; make bin"
52+
- run:
53+
name: Build Panda STM bootstub image
54+
command: |
55+
docker run panda_build /bin/bash -c "cd /panda/board; make obj/bootstub.panda.bin"
56+
- run:
57+
name: Build Pedal STM image
58+
command: |
59+
docker run panda_build /bin/bash -c "cd /panda/board/pedal; make obj/comma.bin"
60+
- run:
61+
name: Build Pedal STM bootstub image
62+
command: |
63+
docker run panda_build /bin/bash -c "cd /panda/board/pedal; make obj/bootstub.bin"
64+
- run:
65+
name: Build ESP image
66+
command: |
67+
docker run panda_build /bin/bash -c "cd /panda/boardesp; ./get_sdk.sh; make user1.bin"
68+
69+
safety_replay:
70+
machine:
71+
docker_layer_caching: true
72+
steps:
73+
- checkout
74+
- run:
75+
name: Build image
76+
command: "docker build -t panda_safety_replay -f tests/safety_replay/Dockerfile ."
77+
- run:
78+
name: Replay drives
79+
command: |
80+
docker run panda_safety_replay /bin/bash -c "cd /openpilot/panda/tests/safety_replay; PYTHONPATH=/openpilot ./test_safety_replay.py"
81+
82+
language_check:
83+
machine:
84+
docker_layer_caching: true
85+
steps:
86+
- checkout
87+
- run:
88+
name: Build image
89+
command: "docker build -t language_check -f tests/language/Dockerfile ."
90+
- run:
91+
name: Check code for bad language
92+
command: |
93+
docker run language_check /bin/bash -c "cd /panda/tests/language; ./test_language.py"
94+
95+
linter_python:
96+
machine:
97+
docker_layer_caching: true
98+
steps:
99+
- checkout
100+
- run:
101+
name: Build image
102+
command: "docker build -t linter_python -f tests/linter_python/Dockerfile ."
103+
- run:
104+
name: Run linter python test
105+
command: |
106+
docker run linter_python /bin/bash -c "cd /panda/tests/linter_python; PYTHONPATH=/ ./flake8_panda.sh"
107+
docker run linter_python /bin/bash -c "cd /panda/tests/linter_python; PYTHONPATH=/ ./pylint_panda.sh"
108+
109+
workflows:
110+
version: 2
111+
main:
112+
jobs:
113+
- safety
114+
- misra-c2012
115+
- build
116+
- safety_replay
117+
- language_check
118+
- linter_python

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
.DS_Store
3+
boardesp/esp-open-sdk

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.pyc
2+
.*.swp
3+
.*.swo
4+
*.o
5+
*.so
6+
*.d
7+
*.dump
8+
a.out
9+
*~
10+
.#*
11+
dist/
12+
pandacan.egg-info/
13+
board/obj/
14+
examples/output.csv
15+
.DS_Store
16+
.vscode
17+
nosetests.xml

Dockerfile

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
FROM ubuntu:16.04
2+
ENV PYTHONUNBUFFERED 1
3+
4+
RUN apt-get update && apt-get install -y \
5+
autoconf \
6+
automake \
7+
bash \
8+
bison \
9+
bzip2 \
10+
curl \
11+
dfu-util \
12+
flex \
13+
g++ \
14+
gawk \
15+
gcc \
16+
git \
17+
gperf \
18+
help2man \
19+
iputils-ping \
20+
libbz2-dev \
21+
libexpat-dev \
22+
libffi-dev \
23+
libssl-dev \
24+
libstdc++-arm-none-eabi-newlib \
25+
libtool \
26+
libtool-bin \
27+
libusb-1.0-0 \
28+
locales \
29+
make \
30+
ncurses-dev \
31+
network-manager \
32+
python-dev \
33+
python-serial \
34+
sed \
35+
texinfo \
36+
unrar-free \
37+
unzip \
38+
wget \
39+
build-essential \
40+
python-dev \
41+
python-pip \
42+
screen \
43+
vim \
44+
wget \
45+
wireless-tools \
46+
zlib1g-dev
47+
48+
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
49+
ENV LANG en_US.UTF-8
50+
ENV LANGUAGE en_US:en
51+
ENV LC_ALL en_US.UTF-8
52+
53+
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
54+
55+
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
56+
RUN pyenv install 3.7.3
57+
RUN pyenv install 2.7.12
58+
RUN pyenv global 3.7.3
59+
RUN pyenv rehash
60+
61+
RUN pip install --upgrade pip==18.0
62+
63+
COPY requirements.txt /tmp/
64+
RUN pip install -r /tmp/requirements.txt
65+
66+
RUN mkdir -p /home/batman
67+
ENV HOME /home/batman
68+
69+
ENV PYTHONPATH /tmp:$PYTHONPATH
70+
71+
COPY ./boardesp/get_sdk_ci.sh /tmp/panda/boardesp/
72+
COPY ./boardesp/python2_make.py /tmp/panda/boardesp/
73+
74+
COPY ./panda_jungle /tmp/panda_jungle
75+
76+
RUN useradd --system -s /sbin/nologin pandauser
77+
RUN mkdir -p /tmp/panda/boardesp/esp-open-sdk
78+
RUN chown pandauser /tmp/panda/boardesp/esp-open-sdk
79+
USER pandauser
80+
RUN cd /tmp/panda/boardesp && ./get_sdk_ci.sh
81+
USER root
82+
83+
ADD ./panda.tar.gz /tmp/panda

Jenkinsfile

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
pipeline {
2+
agent any
3+
environment {
4+
AUTHOR = """${sh(
5+
returnStdout: true,
6+
script: "git --no-pager show -s --format='%an' ${GIT_COMMIT}"
7+
).trim()}"""
8+
9+
DOCKER_IMAGE_TAG = "panda:build-${env.GIT_COMMIT}"
10+
DOCKER_NAME = "panda-test-${env.GIT_COMMIT}"
11+
}
12+
stages {
13+
stage('Build Docker Image') {
14+
steps {
15+
timeout(time: 60, unit: 'MINUTES') {
16+
script {
17+
try {
18+
sh 'cp -R /home/batman/panda_jungle .'
19+
} catch (err) {
20+
echo "Folder already exists"
21+
}
22+
sh 'git archive -v -o panda.tar.gz --format=tar.gz HEAD'
23+
dockerImage = docker.build("${env.DOCKER_IMAGE_TAG}")
24+
}
25+
}
26+
}
27+
}
28+
stage('Test Dev Build (no WIFI)') {
29+
steps {
30+
lock(resource: "Pandas", inversePrecedence: true, quantity: 1){
31+
timeout(time: 60, unit: 'MINUTES') {
32+
script {
33+
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; SKIPWIFI=1 ./run_automated_tests.sh'"
34+
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_dev_nowifi.xml"
35+
sh "docker rm ${env.DOCKER_NAME}"
36+
}
37+
}
38+
}
39+
}
40+
}
41+
stage('Test EON Build') {
42+
steps {
43+
lock(resource: "Pandas", inversePrecedence: true, quantity: 1){
44+
timeout(time: 60, unit: 'MINUTES') {
45+
script {
46+
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'touch /EON; cd /tmp/panda; ./run_automated_tests.sh'"
47+
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_eon.xml"
48+
sh "docker rm ${env.DOCKER_NAME}"
49+
}
50+
}
51+
}
52+
}
53+
}
54+
/*
55+
stage('Test Dev Build (WIFI)') {
56+
steps {
57+
lock(resource: "Pandas", inversePrecedence: true, quantity: 1){
58+
timeout(time: 60, unit: 'MINUTES') {
59+
script {
60+
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; ./run_automated_tests.sh'"
61+
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_dev.xml"
62+
sh "docker rm ${env.DOCKER_NAME}"
63+
}
64+
}
65+
}
66+
}
67+
}
68+
*/
69+
}
70+
post {
71+
failure {
72+
script {
73+
sh "docker rm ${env.DOCKER_NAME} || true"
74+
}
75+
}
76+
always {
77+
junit "test_results*.xml"
78+
}
79+
}
80+
}

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright (c) 2016, Comma.ai, Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)