From 4f2b735472eb921b5edd91c502e0a47d5e4d0cd2 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 11 Jun 2024 09:48:15 +0200 Subject: chore(build): Update --- build/c/scripts/valgrind_test.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 build/c/scripts/valgrind_test.sh (limited to 'build/c/scripts/valgrind_test.sh') diff --git a/build/c/scripts/valgrind_test.sh b/build/c/scripts/valgrind_test.sh new file mode 100755 index 0000000..4d0d964 --- /dev/null +++ b/build/c/scripts/valgrind_test.sh @@ -0,0 +1,29 @@ +#! /usr/bin/env sh + +for arg in "$@"; do + case "$arg" in + "--help" | "-h") + cat <<-EOF + valgrind_test.sh [BINARY_NAME] [ARGS_FOR_BINARY..] +EOF + exit 0 + ;; + esac +done + +binary_name="${1-main}" +[ -n "$1" ] && shift 1 + +log_file="$(git rev-parse --show-toplevel)/target/valgrind_out.report" +mkdir --parents "$(dirname "$log_file")" + +CFLAGS="-ggdb3" make "$binary_name" + +valgrind --leak-check=full \ + --show-leak-kinds=all \ + --show-error-list=yes \ + --track-origins=yes \ + --log-file="$log_file" \ + "./target/$binary_name" "$@" + +cat "$log_file" -- cgit 1.4.1