Skip to content

Run panda safety tests on local branch

martinl edited this page May 9, 2021 · 5 revisions
  • commit and push changes to panda
  • update panda submodule and run panda tests under openpilot directory
cd ../openpilot
pipenv shell
export PYTHONPATH=$PWD
git submodule update --remote panda
echo "copying local replay routes for panda safety_replay"
cp local_routes/*.bz2 panda/tests/safety_replay/
echo "running panda safety unittests" && \
scons -j4 opendbc/ cereal/ && \
cd panda/tests/safety && \
./test.sh && \
echo "running panda safety replay" && \
cd ../safety_replay && \
./test_safety_replay.py

Add debug output while running panda tests

use printf()

-      brake_pressed = (GET_BYTES_48(to_push) & 0xFFF0) > 1;
+      brake_pressed = (GET_BYTES_48(to_push) & 0xFFF0) > 0;
+      int brake_pedal = (GET_BYTES_48(to_push) & 0xFFF0);
+      printf("brake_pressed %d\n", brake_pressed);
+      printf("brake_pedal %d\n", brake_pedal);

Run panda tests in docker

cat run_local_tests.sh
RUN="docker run --rm panda /bin/bash -c"

docker pull docker.io/commaai/panda:latest || true
docker build --cache-from docker.io/commaai/panda:latest -t panda -f Dockerfile.panda .

$RUN "cd /tmp/openpilot && \
      cd panda/tests/misra && ./test_misra.sh"

$RUN "cd /tmp/openpilot && \
      scons -c && \
      scons -j$(nproc) opendbc/ cereal/ && \
      cd panda/tests/safety && \
      ./test.sh"