diff options
author | Thomas Haller <thaller@redhat.com> | 2021-10-08 12:41:56 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-10-08 12:45:51 +0200 |
commit | fc220f94af2a9b84675a9312cc6e50710cd694de (patch) | |
tree | 9b14d1a3d6b6551824ae3c0c2bd070caa5e085b4 /tools | |
parent | 34410c9c3e3f5456b8a5e4fd1c523e7ebbbe1674 (diff) | |
download | NetworkManager-fc220f94af2a9b84675a9312cc6e50710cd694de.tar.gz |
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.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/run-nm-test.sh | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh index 81b94ec648..230a7a66e1 100755 --- a/tools/run-nm-test.sh +++ b/tools/run-nm-test.sh @@ -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 |