forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misra test now fails if the safety files have any Misra violation in …
…them (commaai#221)
- Loading branch information
Showing
1 changed file
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
#!/bin/bash -e | ||
|
||
INPUT1=$1 | ||
|
||
echo $INPUT1 | ||
|
||
git clone https://github.com/danmar/cppcheck.git || true | ||
cd cppcheck | ||
#git checkout 1584e6236758d54b0d246d41771d67338e0bd41b | ||
git fetch | ||
git checkout 44d6066c6fad32e2b0332b3f2b24bd340febaef8 | ||
make -j4 | ||
cd ../../../ | ||
|
||
if [ "$INPUT1" != "safety-only" ]; then | ||
# whole panda code | ||
tests/misra/cppcheck/cppcheck --dump --enable=all --inline-suppr board/main.c 2>/tmp/misra/cppcheck_output.txt || true | ||
python tests/misra/cppcheck/addons/misra.py board/main.c.dump 2>/tmp/misra/misra_output.txt || true | ||
fi | ||
# whole panda code | ||
tests/misra/cppcheck/cppcheck --dump --enable=all --inline-suppr board/main.c 2>/tmp/misra/cppcheck_output.txt || true | ||
python tests/misra/cppcheck/addons/misra.py board/main.c.dump 2>/tmp/misra/misra_output.txt || true | ||
|
||
# violations in safety files | ||
(cat /tmp/misra/misra_output.txt | grep safety) > /tmp/misra/misra_safety_output.txt | ||
(cat /tmp/misra/cppcheck_output.txt | grep safety) > /tmp/misra/cppcheck_safety_output.txt | ||
(cat /tmp/misra/misra_output.txt | grep safety) > /tmp/misra/misra_safety_output.txt || true | ||
(cat /tmp/misra/cppcheck_output.txt | grep safety) > /tmp/misra/cppcheck_safety_output.txt || true | ||
|
||
if [[ -s "/tmp/misra/misra_safety_output.txt" ]] || [[ -s "/tmp/misra/cppcheck_safety_output.txt" ]] | ||
then | ||
echo "Found Misra violations in the safety code:" | ||
cat /tmp/misra/misra_safety_output.txt | ||
cat /tmp/misra/cppcheck_safety_output.txt | ||
exit 1 | ||
fi |