Skip to content

Commit

Permalink
Merge branch 'master' of github.com:commaai/panda
Browse files Browse the repository at this point in the history
  • Loading branch information
robbederks committed Nov 27, 2019
2 parents ca39a5d + e1c34a1 commit 670f90c
Show file tree
Hide file tree
Showing 12 changed files with 404 additions and 245 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ ENV PYTHONPATH /tmp:$PYTHONPATH
COPY ./boardesp/get_sdk_ci.sh /tmp/panda/boardesp/
COPY ./boardesp/python2_make.py /tmp/panda/boardesp/

COPY ./panda_jungle /tmp/panda_jungle

RUN useradd --system -s /sbin/nologin pandauser
RUN mkdir -p /tmp/panda/boardesp/esp-open-sdk
RUN chown pandauser /tmp/panda/boardesp/esp-open-sdk
Expand Down
5 changes: 5 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ pipeline {
steps {
timeout(time: 60, unit: 'MINUTES') {
script {
try {
sh 'cp -R /home/batman/panda_jungle .'
} catch (err) {
echo "Folder already exists"
}
sh 'git archive -v -o panda.tar.gz --format=tar.gz HEAD'
dockerImage = docker.build("${env.DOCKER_IMAGE_TAG}")
}
Expand Down
6 changes: 5 additions & 1 deletion tests/automated/1_program.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from .helpers import test_all_pandas, panda_connect_and_init
from .helpers import reset_pandas, test_all_pandas, panda_connect_and_init

# Reset the pandas before flashing them
def aaaa_reset_before_tests():
reset_pandas()

@test_all_pandas
@panda_connect_and_init
Expand Down
37 changes: 37 additions & 0 deletions tests/automated/2_ignition_orientation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import time
from panda_jungle import PandaJungle # pylint: disable=import-error
from .helpers import panda_jungle, reset_pandas, test_all_pandas, test_all_gen2_pandas, panda_connect_and_init

# Reset the pandas before running tests
def aaaa_reset_before_tests():
reset_pandas()

@test_all_pandas
@panda_connect_and_init
def test_ignition(p):
try:
# Set harness orientation to #2, since the ignition line is on the wrong SBU bus :/
panda_jungle.set_harness_orientation(PandaJungle.HARNESS_ORIENTATION_2)
reset_pandas()
p.reconnect()
panda_jungle.set_ignition(False)
time.sleep(2)
assert p.health()['ignition_line'] == False
panda_jungle.set_ignition(True)
time.sleep(2)
assert p.health()['ignition_line'] == True
finally:
panda_jungle.set_harness_orientation(PandaJungle.HARNESS_ORIENTATION_1)

@test_all_gen2_pandas
@panda_connect_and_init
def test_orientation_detection(p):
seen_orientations = []
for i in range(3):
panda_jungle.set_harness_orientation(i)
reset_pandas()
p.reconnect()
detected_harness_orientation = p.health()['car_harness_status']
if (i == 0 and detected_harness_orientation != 0) or detected_harness_orientation in seen_orientations:
assert False
seen_orientations.append(detected_harness_orientation)
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@
import time
from panda import Panda
from nose.tools import assert_equal, assert_less, assert_greater
from .helpers import SPEED_NORMAL, SPEED_GMLAN, time_many_sends, test_white_and_grey, panda_type_to_serial, test_all_pandas, panda_connect_and_init
from .helpers import start_heartbeat_thread, reset_pandas, SPEED_NORMAL, SPEED_GMLAN, time_many_sends, test_white_and_grey, panda_type_to_serial, test_all_pandas, panda_connect_and_init

# Reset the pandas before running tests
def aaaa_reset_before_tests():
reset_pandas()

@test_all_pandas
@panda_connect_and_init
def test_can_loopback(p):
# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

Expand Down Expand Up @@ -40,6 +47,9 @@ def test_can_loopback(p):
@test_all_pandas
@panda_connect_and_init
def test_safety_nooutput(p):
# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_SILENT)

Expand All @@ -60,6 +70,9 @@ def test_reliability(p):
LOOP_COUNT = 100
MSG_COUNT = 100

# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)
p.set_can_loopback(True)
Expand Down Expand Up @@ -95,6 +108,9 @@ def test_reliability(p):
@test_all_pandas
@panda_connect_and_init
def test_throughput(p):
# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

Expand Down Expand Up @@ -122,6 +138,9 @@ def test_gmlan(p):
if p.legacy:
return

# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

Expand Down Expand Up @@ -153,6 +172,9 @@ def test_gmlan_bad_toggle(p):
if p.legacy:
return

# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

Expand Down
6 changes: 5 additions & 1 deletion tests/automated/3_wifi.py → tests/automated/4_wifi.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import time
from panda import Panda
from .helpers import connect_wifi, test_white, test_all_pandas, panda_type_to_serial, panda_connect_and_init
from .helpers import reset_pandas, connect_wifi, test_white, test_all_pandas, panda_type_to_serial, panda_connect_and_init
import requests

# Reset the pandas before running tests
def aaaa_reset_before_tests():
reset_pandas()

@test_all_pandas
@panda_connect_and_init
def test_get_serial(p):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import time
from panda import Panda
from .helpers import time_many_sends, connect_wifi, test_white, panda_type_to_serial
from .helpers import start_heartbeat_thread, reset_pandas, time_many_sends, connect_wifi, test_white, panda_type_to_serial

# Reset the pandas before running tests
def aaaa_reset_before_tests():
reset_pandas()

@test_white
@panda_type_to_serial
Expand All @@ -16,6 +20,9 @@ def test_throughput(serials=None):
connect_wifi(serials[0])
p = Panda(serials[0])

# Start heartbeat
start_heartbeat_thread(p)

# enable output mode
p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

Expand Down Expand Up @@ -43,6 +50,10 @@ def test_throughput(serials=None):
def test_recv_only(serials=None):
connect_wifi(serials[0])
p = Panda(serials[0])

# Start heartbeat
start_heartbeat_thread(p)

p.set_safety_mode(Panda.SAFETY_ALLOUTPUT)

p.set_can_loopback(True)
Expand Down
195 changes: 0 additions & 195 deletions tests/automated/6_two_panda.py

This file was deleted.

Loading

0 comments on commit 670f90c

Please sign in to comment.