mirror of https://github.com/commaai/panda.git
make misra tests easy to run locally (#1016)
* make misra tests easy to run locally
* auto install
* fix copy
* test the test
* Revert "test the test"
This reverts commit 418abfc728
.
This commit is contained in:
parent
e30f7e8fc7
commit
995aed6550
|
@ -45,6 +45,8 @@ ENV LC_ALL en_US.UTF-8
|
|||
|
||||
RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
|
||||
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
|
||||
|
||||
ENV PANDA_PATH=/tmp/openpilot/panda
|
||||
ENV OPENPILOT_REF="1b0167ce24afb037b36464c40f9c5e0d657e77d9"
|
||||
ENV OPENDBC_REF="387dcf9628cdbcc975caece2e8b0ae1dce5e546d"
|
||||
|
||||
|
@ -54,12 +56,8 @@ RUN pyenv install 3.8.10 && \
|
|||
pyenv rehash && \
|
||||
pip install --no-cache-dir -r /tmp/requirements.txt
|
||||
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/danmar/cppcheck.git && \
|
||||
cd cppcheck && \
|
||||
git fetch && \
|
||||
git checkout e1cff1d1ef92f6a1c6962e0e4153b7353ccad04c && \
|
||||
FILESDIR=/usr/share/cppcheck make -j4 install
|
||||
COPY tests/misra/install.sh /tmp/
|
||||
RUN /tmp/install.sh
|
||||
|
||||
RUN cd /tmp && \
|
||||
git clone https://github.com/commaai/openpilot.git tmppilot || true && \
|
||||
|
@ -80,4 +78,5 @@ RUN cd /tmp/openpilot && \
|
|||
pip install --no-cache-dir --upgrade aenum lru-dict pycurl tenacity atomicwrites serial smbus2 scons
|
||||
|
||||
COPY . /tmp/openpilot/panda
|
||||
RUN rm -rf /tmp/openpilot/panda/.git
|
||||
RUN mv /tmp/cppcheck /tmp/openpilot/panda/tests/misra && \
|
||||
rm -rf /tmp/openpilot/panda/.git
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
cd $DIR
|
||||
if [ ! -d cppcheck/ ]; then
|
||||
git clone https://github.com/danmar/cppcheck.git
|
||||
fi
|
||||
|
||||
cd cppcheck
|
||||
git fetch
|
||||
git checkout e1cff1d1ef92f6a1c6962e0e4153b7353ccad04c
|
||||
make clean
|
||||
make MATCHCOMPILTER=yes CXXFLAGS="-O2" -j8
|
|
@ -1,20 +1,30 @@
|
|||
#!/bin/bash -e
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
PANDA_DIR=../..
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
PANDA_DIR=$DIR/../../
|
||||
|
||||
mkdir /tmp/misra || true
|
||||
CPPCHECK_DIR=$DIR/cppcheck
|
||||
CPPCHECK=$CPPCHECK_DIR/cppcheck
|
||||
|
||||
mkdir -p /tmp/misra
|
||||
ERROR_CODE=0
|
||||
|
||||
# install cppcheck if missing
|
||||
if [ ! -d cppcheck/ ]; then
|
||||
$DIR/install.sh
|
||||
fi
|
||||
|
||||
# generate coverage matrix
|
||||
#python tests/misra/cppcheck/addons/misra.py -generate-table > tests/misra/coverage_table
|
||||
|
||||
printf "\nPANDA F4 CODE\n"
|
||||
cppcheck -DPANDA -DSTM32F4 -UPEDAL -DCAN3 -DUID_BASE \
|
||||
--suppressions-list=suppressions.txt --suppress=*:*inc/* \
|
||||
-I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \
|
||||
$PANDA_DIR/board/main.c 2>/tmp/misra/cppcheck_f4_output.txt
|
||||
$CPPCHECK -DPANDA -DSTM32F4 -UPEDAL -DCAN3 -DUID_BASE \
|
||||
--suppressions-list=suppressions.txt --suppress=*:*inc/* \
|
||||
-I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \
|
||||
$PANDA_DIR/board/main.c 2>/tmp/misra/cppcheck_f4_output.txt
|
||||
|
||||
python /usr/share/cppcheck/addons/misra.py $PANDA_DIR/board/main.c.dump 2> /tmp/misra/misra_f4_output.txt || true
|
||||
python $CPPCHECK_DIR/addons/misra.py $PANDA_DIR/board/main.c.dump 2> /tmp/misra/misra_f4_output.txt || true
|
||||
|
||||
# strip (information) lines
|
||||
cppcheck_f4_output=$( cat /tmp/misra/cppcheck_f4_output.txt | grep -v ": information: " ) || true
|
||||
|
@ -22,12 +32,12 @@ misra_f4_output=$( cat /tmp/misra/misra_f4_output.txt | grep -v ": information:
|
|||
|
||||
|
||||
printf "\nPANDA H7 CODE\n"
|
||||
cppcheck -DPANDA -DSTM32H7 -UPEDAL -DUID_BASE \
|
||||
--suppressions-list=suppressions.txt --suppress=*:*inc/* \
|
||||
-I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \
|
||||
$PANDA_DIR/board/main.c 2>/tmp/misra/cppcheck_h7_output.txt
|
||||
$CPPCHECK -DPANDA -DSTM32H7 -UPEDAL -DUID_BASE \
|
||||
--suppressions-list=suppressions.txt --suppress=*:*inc/* \
|
||||
-I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \
|
||||
$PANDA_DIR/board/main.c 2>/tmp/misra/cppcheck_h7_output.txt
|
||||
|
||||
python /usr/share/cppcheck/addons/misra.py $PANDA_DIR/board/main.c.dump 2> /tmp/misra/misra_h7_output.txt || true
|
||||
python $CPPCHECK_DIR/addons/misra.py $PANDA_DIR/board/main.c.dump 2> /tmp/misra/misra_h7_output.txt || true
|
||||
|
||||
# strip (information) lines
|
||||
cppcheck_h7_output=$( cat /tmp/misra/cppcheck_h7_output.txt | grep -v ": information: " ) || true
|
||||
|
@ -35,12 +45,12 @@ misra_h7_output=$( cat /tmp/misra/misra_h7_output.txt | grep -v ": information:
|
|||
|
||||
|
||||
printf "\nPEDAL CODE\n"
|
||||
cppcheck -UPANDA -DSTM32F2 -DPEDAL -UCAN3 \
|
||||
--suppressions-list=suppressions.txt --suppress=*:*inc/* \
|
||||
-I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \
|
||||
$PANDA_DIR/board/pedal/main.c 2>/tmp/misra/cppcheck_pedal_output.txt
|
||||
$CPPCHECK -UPANDA -DSTM32F2 -DPEDAL -UCAN3 \
|
||||
--suppressions-list=suppressions.txt --suppress=*:*inc/* \
|
||||
-I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \
|
||||
$PANDA_DIR/board/pedal/main.c 2>/tmp/misra/cppcheck_pedal_output.txt
|
||||
|
||||
python /usr/share/cppcheck/addons/misra.py $PANDA_DIR/board/pedal/main.c.dump 2> /tmp/misra/misra_pedal_output.txt || true
|
||||
python $CPPCHECK_DIR/addons/misra.py $PANDA_DIR/board/pedal/main.c.dump 2> /tmp/misra/misra_pedal_output.txt || true
|
||||
|
||||
# strip (information) lines
|
||||
cppcheck_pedal_output=$( cat /tmp/misra/cppcheck_pedal_output.txt | grep -v ": information: " ) || true
|
||||
|
|
Loading…
Reference in New Issue