Skip to content

Commit

Permalink
misra mutations test - git diff error fix (#1964)
Browse files Browse the repository at this point in the history
fix misra mutations - don't run git diff in temp folder
  • Loading branch information
dzid26 authored Jun 4, 2024
1 parent fec68d0 commit b6b8144
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions tests/misra/test_misra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ fi

# ensure checked in coverage table is up to date
cd $DIR
python $CPPCHECK_DIR/addons/misra.py -generate-table > coverage_table
if ! git diff --quiet coverage_table; then
echo -e "${YELLOW}MISRA coverage table doesn't match. Update and commit:${NC}"
exit 1
if [ -z "$SKIP_TABLES_DIFF" ]; then
python $CPPCHECK_DIR/addons/misra.py -generate-table > coverage_table
if ! git diff --quiet coverage_table; then
echo -e "${YELLOW}MISRA coverage table doesn't match. Update and commit:${NC}"
exit 2
fi
fi

cd $PANDA_DIR
Expand Down Expand Up @@ -77,7 +79,7 @@ printf "\n${GREEN}Success!${NC} took $SECONDS seconds\n"

# ensure list of checkers is up to date
cd $DIR
if ! git diff --quiet $CHECKLIST; then
if [ -z "$SKIP_TABLES_DIFF" ] && ! git diff --quiet coverage_table; then

This comment has been minimized.

Copy link
@dzid26

dzid26 Jun 4, 2024

Author Contributor

Oops, it should be git diff --quiet $CHECKLIST. Fixed in #1969

echo -e "\n${YELLOW}WARNING: Cppcheck checkers.txt report has changed. Review and commit...${NC}"
exit 1
exit 3
fi
2 changes: 1 addition & 1 deletion tests/misra/test_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ def test_misra_mutation(fn, patch, should_fail):
assert r == 0

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

0 comments on commit b6b8144

Please sign in to comment.