mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 13:38:43 +02:00
valgrind: rework run-test-valgrind.sh script not to print unrelated message
If the valgrind logfile is empty, don't log an error message with the location of the logfile. Also, if the test didn't fail due to memleaks, log a different message.
This commit is contained in:
parent
ca3fb3edcd
commit
2a5d17eb5f
1 changed files with 29 additions and 17 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
LIBTOOL="$1"; shift
|
LIBTOOL="$1"; shift
|
||||||
VALGRIND="$1"; shift
|
VALGRIND="$1"; shift
|
||||||
SUPPRESSIONS="$1"; shift
|
SUPPRESSIONS="$1"; shift
|
||||||
|
VALGRIND_ERROR=37
|
||||||
if [ "$1" = "--launch-dbus" ]; then
|
if [ "$1" = "--launch-dbus" ]; then
|
||||||
# Spawn DBus
|
# Spawn DBus
|
||||||
eval `dbus-launch --sh-syntax`
|
eval `dbus-launch --sh-syntax`
|
||||||
|
|
@ -22,7 +23,7 @@ export G_SLICE=always-malloc
|
||||||
export G_DEBUG=gc-friendly
|
export G_DEBUG=gc-friendly
|
||||||
$LIBTOOL --mode=execute "$VALGRIND" \
|
$LIBTOOL --mode=execute "$VALGRIND" \
|
||||||
--quiet \
|
--quiet \
|
||||||
--error-exitcode=1 \
|
--error-exitcode=$VALGRIND_ERROR \
|
||||||
--leak-check=full \
|
--leak-check=full \
|
||||||
--gen-suppressions=all \
|
--gen-suppressions=all \
|
||||||
--suppressions="$SUPPRESSIONS" \
|
--suppressions="$SUPPRESSIONS" \
|
||||||
|
|
@ -31,28 +32,39 @@ $LIBTOOL --mode=execute "$VALGRIND" \
|
||||||
"$@"
|
"$@"
|
||||||
RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
if [ $RESULT -eq 0 -a "$(wc -c "$LOGFILE" | awk '{print$1}')" -ne 0 ]; then
|
test -s "$LOGFILE"
|
||||||
echo "valgrind succeeded, but log is not empty: $LOGFILE"
|
HAS_ERRORS=$?
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
||||||
echo "valgrind failed! Check the log at '`realpath $LOGFILE`'." >&2
|
if [ $HAS_ERRORS -ne 0 ]; then
|
||||||
UNRESOLVED=$(awk -F: '/obj:\// {print $NF}' "$LOGFILE" | sort | uniq)
|
rm -f "$LOGFILE"
|
||||||
if [ -n "$UNRESOLVED" ]; then
|
elif [ $RESULT -ne $VALGRIND_ERROR ]; then
|
||||||
echo Some addresses could not be resolved into symbols. >&2
|
# the test (probably) didn't fail due to valgrind.
|
||||||
echo The errors might get suppressed when you install the debuging symbols. >&2
|
echo "The test failed. Also check the valgrind log at '`realpath "$LOGFILE"`'" >&2
|
||||||
if [ -x /usr/bin/dnf ]; then
|
else
|
||||||
echo Hint: dnf debuginfo-install $UNRESOLVED >&2
|
echo "valgrind failed! Check the log at '`realpath "$LOGFILE"`'" >&2
|
||||||
elif [ -x /usr/bin/debuginfo-install ]; then
|
UNRESOLVED=$(awk -F: '/obj:\// {print $NF}' "$LOGFILE" | sort | uniq)
|
||||||
echo Hint: debuginfo-install $UNRESOLVED >&2
|
if [ -n "$UNRESOLVED" ]; then
|
||||||
else
|
echo Some addresses could not be resolved into symbols. >&2
|
||||||
echo Files without debugging symbols: $UNRESOLVED >&2
|
echo The errors might get suppressed when you install the debuging symbols. >&2
|
||||||
|
if [ -x /usr/bin/dnf ]; then
|
||||||
|
echo Hint: dnf debuginfo-install $UNRESOLVED >&2
|
||||||
|
elif [ -x /usr/bin/debuginfo-install ]; then
|
||||||
|
echo Hint: debuginfo-install $UNRESOLVED >&2
|
||||||
|
else
|
||||||
|
echo Files without debugging symbols: $UNRESOLVED >&2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find -name "$LOGFILE" -size 0 -delete
|
if [ $HAS_ERRORS -eq 0 ]; then
|
||||||
|
# shouldn't actually happen...
|
||||||
|
echo "valgrind succeeded, but log is not empty: '`realpath "$LOGFILE"`'" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f "$LOGFILE"
|
||||||
|
|
||||||
exit $RESULT
|
exit $RESULT
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue