mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-27 10:30:36 +01:00
build/tests: ignore all valgrind warnings about unhandled syscalls
valgrind might log warnings about syscalls that it doesn't implement.
When we run valgrind tests, we check that the command exits with
success, but we also check that there is no unexpected content in the
valgrind log.
Those warnings are not relevant for us. We don't unit-tests valgrind, we
unit tests NetworkManager. Let's always remove such warnings with `sed`.
We already did that previously, but only for a explicit list of tests.
Now do it for all tests.
This is currently relevant on Fedora 35 and Ubuntu devel, where the
"close_range" syscall is used by libc, but not supported by valgrind.
While at it, rework the confusing logic of "HAS_ERRORS" variable.
(cherry picked from commit fc220f94af)
This commit is contained in:
parent
45f8c78c61
commit
517e12c706
1 changed files with 10 additions and 27 deletions
|
|
@ -331,11 +331,11 @@ export NM_TEST_UNDER_VALGRIND=1
|
|||
"${TEST_ARGV[@]}"
|
||||
RESULT=$?
|
||||
|
||||
test -s "$LOGFILE"
|
||||
HAS_ERRORS=$?
|
||||
LOGFILE_HAS_WARNINGS=0
|
||||
test -s "$LOGFILE" && LOGFILE_HAS_WARNINGS=1
|
||||
|
||||
if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
||||
if [ $HAS_ERRORS -ne 0 ]; then
|
||||
if [ "$LOGFILE_HAS_WARNINGS" != 1 ]; then
|
||||
rm -f "$LOGFILE"
|
||||
elif [ $RESULT -ne $VALGRIND_ERROR ]; then
|
||||
# the test (probably) didn't fail due to valgrind.
|
||||
|
|
@ -358,32 +358,15 @@ if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
|
|||
exit $RESULT
|
||||
fi
|
||||
|
||||
if [ $HAS_ERRORS -eq 0 ]; then
|
||||
# valgrind doesn't support setns syscall and spams the logfile.
|
||||
# hack around it...
|
||||
case "$TEST_NAME" in
|
||||
'test-acd' | \
|
||||
'test-address-linux' | \
|
||||
'test-cleanup-linux' | \
|
||||
'test-config' | \
|
||||
'test-l3cfg' | \
|
||||
'test-link-linux' | \
|
||||
'test-lldp' | \
|
||||
'test-nm-client' | \
|
||||
'test-platform-general' | \
|
||||
'test-remote-settings-client' | \
|
||||
'test-route-linux' | \
|
||||
'test-secret-agent' | \
|
||||
'test-service-providers' | \
|
||||
'test-tc-linux' )
|
||||
if [ -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
|
||||
HAS_ERRORS=1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ "$LOGFILE_HAS_WARNINGS" = 1 ]; then
|
||||
# valgrind may not support certain syscalls and spam the logfile with warnings.
|
||||
# Hack around this. If the logfile only contains such warnings, ignore them.
|
||||
if [ -z "$(sed -e '/^--[0-9]\+-- WARNING: unhandled .* syscall: /,/^--[0-9]\+-- it at http.*\.$/d' "$LOGFILE")" ]; then
|
||||
LOGFILE_HAS_WARNINGS=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $HAS_ERRORS -eq 0 ]; then
|
||||
if [ "$LOGFILE_HAS_WARNINGS" = 1 ]; then
|
||||
# shouldn't actually happen...
|
||||
echo "valgrind succeeded, but log is not empty: '`realpath "$LOGFILE"`'" >&2
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue