Skip to content

Commit

Permalink
fixing bad criterion fds adding more reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximaz committed May 2, 2024
1 parent 727a1ed commit c6301d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
run: "echo \"${{ env.VALGRIND_SUPPRESSIONS }}\" > valgrind.supp"

- name: "Run valgrind"
run: "[ -f \"${{ env.UNIT_TESTS }}\" ] && valgrind -s --leak-check=full --track-origins=yes --read-var-info=yes --trace-children=yes --show-leak-kinds=all --read-inline-info=yes --errors-for-leak-kinds=all --track-fds=yes --show-reachable=yes --gen-suppressions=all --suppressions=valgrind.supp ${{ env.UNIT_TESTS }} 2>${{ env.VALGRIND_REPORTS }}"
run: "[ -f \"${{ env.UNIT_TESTS }}\" ] && CRITERION_NO_EARLY_EXIT=1 valgrind -s --leak-check=full --track-origins=yes --read-var-info=yes --trace-children=yes --show-leak-kinds=all --read-inline-info=yes --errors-for-leak-kinds=all --track-fds=yes --expensive-definedness-checks=yes --gen-suppressions=all --suppressions=/usr/libexec/valgrind/default.supp --suppressions=valgrind.supp ${{ env.UNIT_TESTS }} --verbose 2>${{ env.VALGRIND_REPORTS }}"

- name: "Analyze valgrind report"
run: |
Expand All @@ -143,7 +143,7 @@ jobs:
block=""
while IFS= read -r line; do
if [[ "${block}" != "" ]]; then
if [[ $(echo "${line}" | grep '^==.*== $') ]]; then
if [[ $(echo "${line}" | grep '^==.*== $') && $(echo "${block}" | grep '==.*== by 0x.*: stdpipe_options (in /usr/local/lib/libcriterion.so.3.2.0)') == "" && $(echo "${block}" | grep '==.*== Open file descriptor .*: /dev/shm/bxf_arena_.* (deleted)') == "" ]]; then
echo "::error title=Valgrind Error::${block}"
block=""
status=1
Expand All @@ -159,7 +159,19 @@ jobs:
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== Open file descriptor .*: .*$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== LEAK SUMMARY:.*$') ]]; then
elif [[ $(echo "${line}" | grep '^==.*== Invalid free().*$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== Mismatched free() / delete / delete \[\].*$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== Syscall param .* points to uninitialised byte(s).*$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== Source and destination overlap in .*$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== Argument '.*' of function .* has a fishy (possibly negative) value: .*$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== .*alloc() with size 0$') ]]; then
block="${line}"
elif [[ $(echo "${line}" | grep '^==.*== Invalid alignment value: .* (should be power of 2)$') ]]; then
block="${line}"
fi
done < ${{ env.VALGRIND_REPORTS }}
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ possible, then the valgrind tests will make sure that the code you wrote, both
the tests and the actual implementations, are not leaking at all. Valgrind will
look for :
- memory leaks (including inside `fork()` children),
- invalid `free()`, `delete` and `delete[]`,
- invalid system call params (uninitialised bytes),
- overlaping for memory operations (`memmove`, `memcpy`, ...),
- `fishy` arguments (possibly negative values),
- invalid arguments for `*alloc` functions (`*alloc(0)`),
- invalid alignment value,
- unclosed file descriptor,
- invalid read/writes,
- conditionnal jumps or move depends on uninitialised value(s),
Expand Down

0 comments on commit c6301d3

Please sign in to comment.