File: valgrind.sh.in

package info (click to toggle)
nut 2.8.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,356 kB
  • sloc: ansic: 123,904; sh: 14,718; cpp: 12,558; makefile: 5,212; python: 1,114; perl: 855; xml: 47
file content (29 lines) | stat: -rwxr-xr-x 1,097 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

# Copyright (C) 2024-2025 by Jim Klimov <jimklimov+nut@gmail.com>
# NOTE: If there are system problems to suppress, re-run the test with
#    --gen-suppressions=all option, and update the .valgrind.supp file.

SCRIPTDIR="`dirname "$0"`"
SCRIPTDIR="`cd "$SCRIPTDIR" && pwd`"

LTEXEC=""
[ -n "${LIBTOOL-}" ] || LIBTOOL="`command -v glibtool`" 2>/dev/null
[ -n "${LIBTOOL-}" ] || LIBTOOL="`command -v libtool`" 2>/dev/null
[ -z "${LIBTOOL}"  ] || LTEXEC="${LIBTOOL} --mode=execute "

# Allow to run un-parsed "sh ${top_srcdir}/scripts/valgrind/valgrind.sh.in"
# with reasonable success:
[ -n "${VALGRIND-}" ] || case '@VALGRIND@' in [@]*|none) ;; *) VALGRIND='@VALGRIND@' ;; esac
[ -n "${VALGRIND-}" ] || VALGRIND="valgrind"

# TODO: Also wrap tool=callgrind e.g. via $0 symlink name?

exec ${LTEXEC} \
${VALGRIND} \
	--tool=memcheck --verbose \
	--leak-check=full --show-reachable=yes --error-exitcode=1 --show-error-list=yes \
	--trace-children=yes --track-fds=yes --show-leak-kinds=all --track-origins=yes \
	--suppressions="${SCRIPTDIR}/.valgrind.supp" \
	${VALGRIND_OPTIONS-} \
	"$@"