From 35bff5db51e55878cf838a4e23ae552f98a7fe7d Mon Sep 17 00:00:00 2001 From: Adeeb <8762862+adeebshihadeh@users.noreply.github.com> Date: Sun, 7 Jun 2020 21:42:23 -0700 Subject: [PATCH] Speed up misra test in CI (#552) --- .github/workflows/test.yaml | 2 +- Dockerfile.panda | 7 +++++++ tests/misra/test_misra.sh | 30 +++++++++++++----------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fea9aa2b1..b329cbbfe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,7 +14,7 @@ jobs: name: docker push runs-on: ubuntu-16.04 timeout-minutes: 45 - if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/panda' + #if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/panda' steps: - uses: actions/checkout@v2 - name: Build Docker image diff --git a/Dockerfile.panda b/Dockerfile.panda index dbc01082a..e5830d339 100644 --- a/Dockerfile.panda +++ b/Dockerfile.panda @@ -49,6 +49,13 @@ RUN pyenv install 3.7.3 && \ pip install --no-cache-dir --upgrade pip==18.0 && \ 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 e46191e6e809272d8b34feca8999ee413f716b80 && \ + FILESDIR=/usr/share/cppcheck make -j4 install + RUN cd /tmp && \ git clone https://github.com/commaai/openpilot.git tmppilot || true && \ cd /tmp/tmppilot && \ diff --git a/tests/misra/test_misra.sh b/tests/misra/test_misra.sh index 47a38dad2..ec9dd8ff6 100755 --- a/tests/misra/test_misra.sh +++ b/tests/misra/test_misra.sh @@ -1,23 +1,19 @@ #!/bin/bash -e +PANDA_DIR=../.. + mkdir /tmp/misra || true -git clone https://github.com/danmar/cppcheck.git || true -cd cppcheck -git fetch -git checkout e46191e6e809272d8b34feca8999ee413f716b80 -make -j4 -cd ../../../ # generate coverage matrix -python tests/misra/cppcheck/addons/misra.py -generate-table > tests/misra/coverage_table +#python tests/misra/cppcheck/addons/misra.py -generate-table > tests/misra/coverage_table printf "\nPANDA CODE\n" -tests/misra/cppcheck/cppcheck -DPANDA -UPEDAL -DCAN3 -DUID_BASE -DEON \ - --suppressions-list=tests/misra/suppressions.txt \ - --dump --enable=all --inline-suppr --force \ - board/main.c 2>/tmp/misra/cppcheck_output.txt +cppcheck -DPANDA -UPEDAL -DCAN3 -DUID_BASE -DEON \ + --suppressions-list=suppressions.txt \ + --dump --enable=all --inline-suppr --force \ + $PANDA_DIR/board/main.c 2>/tmp/misra/cppcheck_output.txt -python tests/misra/cppcheck/addons/misra.py board/main.c.dump 2> /tmp/misra/misra_output.txt || true +python /usr/share/cppcheck/addons/misra.py $PANDA_DIR/board/main.c.dump 2> /tmp/misra/misra_output.txt || true # strip (information) lines cppcheck_output=$( cat /tmp/misra/cppcheck_output.txt | grep -v ": information: " ) || true @@ -25,12 +21,12 @@ misra_output=$( cat /tmp/misra/misra_output.txt | grep -v ": information: " ) || printf "\nPEDAL CODE\n" -tests/misra/cppcheck/cppcheck -UPANDA -DPEDAL -UCAN3 \ - --suppressions-list=tests/misra/suppressions.txt \ - -I board/ --dump --enable=all --inline-suppr --force \ - board/pedal/main.c 2>/tmp/misra/cppcheck_pedal_output.txt +cppcheck -UPANDA -DPEDAL -UCAN3 \ + --suppressions-list=suppressions.txt \ + -I $PANDA_DIR/board/ --dump --enable=all --inline-suppr --force \ + $PANDA_DIR/board/pedal/main.c 2>/tmp/misra/cppcheck_pedal_output.txt -python tests/misra/cppcheck/addons/misra.py board/pedal/main.c.dump 2> /tmp/misra/misra_pedal_output.txt || true +python /usr/share/cppcheck/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