Skip to content

Commit

Permalink
mutation test speedup - skip unused function per build
Browse files Browse the repository at this point in the history
  • Loading branch information
dzid26 committed Jun 7, 2024
1 parent 3c8a570 commit f8d5b49
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
29 changes: 16 additions & 13 deletions tests/misra/test_misra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,23 @@ cppcheck --project=$PANDA_DIR/compile_commands.json \


# Test individual targets for unused functions
printf "\n${GREEN}** Check unused functions per build - Pandas **${NC}\n"
cppcheck --project=$PANDA_DIR/compile_commands.json \
--enable=unusedFunction \
-i$PANDA_DIR/board/bootstub.c \
-i$PANDA_DIR/board/jungle/ \
-i$PANDA_DIR/crypto/
printf "\n${GREEN}Success!${NC} took $SECONDS seconds\n"
if [ -z "$SKIP_PER_BUILD_CHECKS" ]; then
printf "\n${GREEN}** Check unused functions per build - Pandas **${NC}\n"
cppcheck --project=$PANDA_DIR/compile_commands.json \
--enable=unusedFunction \
-i$PANDA_DIR/board/bootstub.c \
-i$PANDA_DIR/board/jungle/ \
-i$PANDA_DIR/crypto/

printf "\n${GREEN}** Check unused functions per build - Bootstub **${NC}\n"
cppcheck --project=$PANDA_DIR/compile_commands.json \
--enable=unusedFunction \
-i$PANDA_DIR/board/main.c \
-i$PANDA_DIR/board/jungle/ -UPANDA_JUNGLE \
-i$PANDA_DIR/crypto/
printf "\n${GREEN}** Check unused functions per build - Bootstub **${NC}\n"
cppcheck --project=$PANDA_DIR/compile_commands.json \
--enable=unusedFunction \
-i$PANDA_DIR/board/main.c \
-i$PANDA_DIR/board/jungle/ -UPANDA_JUNGLE \
-i$PANDA_DIR/crypto/
fi

printf "\n${GREEN}Success!${NC} took $SECONDS seconds\n"

# ensure list of checkers is up to date
cd $DIR
Expand Down
2 changes: 1 addition & 1 deletion tests/misra/test_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ def test_misra_mutation(fn, patch, should_fail):
assert r == 0

# run test
r = subprocess.run("SKIP_TABLES_DIFF=1 tests/misra/test_misra.sh", cwd=tmp, shell=True)
r = subprocess.run("SKIP_TABLES_DIFF=1 SKIP_PER_BUILD_CHECKS=1 tests/misra/test_misra.sh", cwd=tmp, shell=True)
failed = r.returncode != 0
assert failed == should_fail

0 comments on commit f8d5b49

Please sign in to comment.