-
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.
Merge pull request #2 from Ximaz/v1.2.0
V1.2.0
- Loading branch information
Showing
5 changed files
with
114 additions
and
75 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,11 +1,11 @@ | ||
FROM debian:stable | ||
|
||
RUN apt update -y \ | ||
&& apt upgrade -y \ | ||
RUN apt update -y \ | ||
&& apt upgrade -y \ | ||
&& apt install -y build-essential valgrind | ||
|
||
WORKDIR /root/ | ||
|
||
COPY valgrind.sh /root/valgrind.sh | ||
COPY valgrind.bash /root/valgrind.bash | ||
|
||
ENTRYPOINT [ "/root/valgrind.sh" ] | ||
ENTRYPOINT [ "/root/valgrind.bash" ] |
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,44 +1,95 @@ | ||
# Valgrind Checker Action | ||
|
||
A GitHub action allowing you to check for memory leaks on your binaries, libraries and unit tests. | ||
A GitHub Action for checking your memory management using [Valgrind](https://valgrind.org). | ||
|
||
# Usage | ||
This Action will check for : | ||
- un`free`'d memory, | ||
- invalid `read` or `write` operations, | ||
- un`close`'d file descriptors (files and sockets), | ||
- invalid usage of `free`, `delete`, `delete []` or `realloc`, | ||
- uninitialised `syscall` params, | ||
- overlaps between sources and destinations for `memcpy`, `memmove`, etc..., | ||
- `fishy` arguments (possibly negative values) for `unsigned` expected, | ||
- memory allocation with a size of `0`, | ||
- invalid alignment values. | ||
|
||
If you want to have more details about the errors this Action supports, you can | ||
check the [`4.2. Explanation of error messages from Memcheck`](https://valgrind.org/docs/manual/mc-manual.html) section. | ||
|
||
Here is how you may use the action : | ||
# Usage | ||
|
||
```yml | ||
name: Valgrind Tester | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
check-memory-leaks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v4.1.4 | ||
|
||
- name: "Compile program" | ||
run: gcc -g src/*.c -o program | ||
|
||
- name: "Valgrind Checks" | ||
uses: Ximaz/valgrind-action@v1.1.1 | ||
with: | ||
binary_path: "./program" | ||
binary_args: "--arg1 value1 --arg2 value2" | ||
``` | ||
- uses: Ximaz/valgrind-action@v1.2.0 | ||
with: | ||
# Either absolute or reative path to the binary you want to check the | ||
# memory on. | ||
binary_path: "" | ||
|
||
# Customization | ||
# A string containing all the arguments to pass the the binary when it | ||
# gets checked by Valgrind. | ||
# | ||
# Default: "" | ||
binary_args: "" | ||
|
||
`binary_args`: The args to pass to the binary when checked (string format) | ||
# The value of the `LD_LIBRARY_PATH` environment variable so that the | ||
# binary can be executed with your custom libraries, if any. | ||
# | ||
# Default: "" | ||
ld_library_path: "" | ||
|
||
`ld_library_path`: Custom library path (for dymanic locally-compiled libraries) | ||
# Redzone size used by Valgrind. It represents the blocks that Valgrind | ||
# will check before, and after any allocated pointer so that it will | ||
# look if you're trying to operate on those bytes, which you are not | ||
# supposed to. | ||
# | ||
# Default: 16 | ||
redzone_size: 16 | ||
|
||
`track_file_descriptors`: Whether or not to track file descriptors (default: `true`) | ||
# Whether or not to track unclosed file descriptors. | ||
# Default: true | ||
track_file_descriptors: true | ||
|
||
`treat_error_as_warning`: The workflow won't exit as error, and error annotations will be replaced by warnings (default: `false`) | ||
# Whether or not to treat error as warning. This implies that, if set | ||
# to true, then the action will not exit with an error status, even if | ||
# Valgrind found issues during the binary execution. Also, this implies | ||
# that in your workflow summary, you will see warning annotations | ||
# instead of error ones. | ||
# | ||
# Default: false | ||
treat_error_as_warning: false | ||
|
||
`valgrind_suppressions`: String containing Valgrind suppressions (will be put inside a suppressions file) | ||
# Valgrind suppressions. If specified, the content will be written into | ||
# a local file which will be passed to Valgrind. It represents a set of | ||
# specific checks to avoid. For instance, you can avoid checks for a | ||
# specific function, inside a specific program or library, etc... | ||
# Foe more detail, you can check the `2.5. Suppressing errors` section | ||
# on the Valgrind's documentation : | ||
# https://valgrind.org/docs/manual/manual-core.html | ||
# | ||
# For each found error by Valgrind, a generated suppression will be | ||
# logged inside your workflow's logs. That way, you will be able to see | ||
# if any dependency, unrelated to your implementation, is faulty for | ||
# not free'ing it's own memory or file descriptors. | ||
# | ||
# Generally, you want to avoid using this because you may tend to use | ||
# it badly in order to suppress errors about your own implemnetations, | ||
# so be careful. | ||
# | ||
# Default: "" | ||
# | ||
# The example below showcases how to avoid checking for the `free` | ||
# function, inside the `main` function. | ||
valgrind_suppressions: | | ||
{ | ||
DontCheckFreeInMain | ||
Memcheck:Free | ||
fun:free | ||
fun:main | ||
} | ||
`verbose`: Asking Valgrind to be verbose (default: `false`) | ||
# Whether or not Valgrind should be verbose. It may be useful in case | ||
# you want to debug things. | ||
# | ||
# Default: false | ||
verbose: false | ||
``` |
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
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,5 +1,3 @@ | ||
version: "3.9" | ||
|
||
services: | ||
valgrind-action: | ||
build: | ||
|
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