Skip to content

Commit

Permalink
Enable caching in test_misra (commaai#1798)
Browse files Browse the repository at this point in the history
* enable cachinng

* hased args

* md5

* cleanup
  • Loading branch information
bongbui321 authored Jan 14, 2024
1 parent 817d68f commit d661619
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions tests/misra/test_misra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,16 @@ cd $PANDA_DIR
scons -j8

cppcheck() {
build_dir=/tmp/cppcheck_build
hashed_args=$(echo -n "$@" | md5sum | awk '{print $1}')
build_dir=/tmp/cppcheck_build/$hashed_args
mkdir -p $build_dir

report="$(mktemp)"
$CPPCHECK_DIR/cppcheck --enable=all --force --inline-suppr -I $PANDA_DIR/board/ \
-I $gcc_inc "$(arm-none-eabi-gcc -print-file-name=include)" \
--suppressions-list=$DIR/suppressions.txt --suppress=*:*inc/* \
--suppress=*:*include/* --error-exitcode=2 --addon=misra --checkers-report=$report \
--suppress=*:*include/* --error-exitcode=2 --addon=misra \
--cppcheck-build-dir=$build_dir \
"$@"

# sanity check the reported coverage
no="$(grep '^No ' $report | wc -l)"
yes="$(grep '^Yes' $report | wc -l)"
echo "$yes checks enabled, $no disabled"
if [[ $yes -lt 250 ]]; then
echo "Count of enabled checks seems too low."
exit 1
fi
if [[ $no -ne 99 ]]; then
echo "Disabled check count threshold doesn't match, update to $no"
exit 1
fi
}

printf "\n${GREEN}** PANDA F4 CODE **${NC}\n"
Expand Down

0 comments on commit d661619

Please sign in to comment.