[PATCH 2/2] tests: Refresh valgrind suppressions

Michal Privoznik posted 2 patches 2 years, 6 months ago
[PATCH 2/2] tests: Refresh valgrind suppressions
Posted by Michal Privoznik 2 years, 6 months ago
Since nobody is expected to run valgrind over scripts now, we can
drop plenty of suppressions. Also, there are some old ones that
no longer exist and new ones, that are not covered.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/.valgrind.supp | 188 ++++++++++---------------------------------
 1 file changed, 41 insertions(+), 147 deletions(-)

diff --git a/tests/.valgrind.supp b/tests/.valgrind.supp
index f78b3b1f72..9ccefab0df 100644
--- a/tests/.valgrind.supp
+++ b/tests/.valgrind.supp
@@ -1,163 +1,57 @@
 {
-   bashMemoryLeak1
+   glib-memory-leak1
    Memcheck:Leak
-   fun:malloc
-   fun:xmalloc
-   ...
-   fun:execute_command_internal
+   match-leak-kinds: possible
+   fun:calloc
+   fun:allocate_dtv
+   fun:_dl_allocate_tls
+   fun:pthread_create@@GLIBC_2.34
+   fun:g_system_thread_new
    ...
-   obj:*/bin/bash
+   fun:g_task_get_type_once
+   fun:g_task_get_type
+   fun:_g_dbus_initialize.part.0
+   fun:g_dbus_error_new_for_dbus_error
+   fun:wrap_g_dbus_connection_call_sync
 }
 {
-   bashMemoryLeak2
+   glib-memory-leak2
    Memcheck:Leak
+   match-leak-kinds: possible
    fun:malloc
-   fun:xmalloc
+   fun:tsearch
+   fun:__add_to_environ
+   fun:setenv
+   fun:g_setenv
    ...
-   fun:yyparse
-   fun:parse_command
-   fun:read_command
-   ...
-   obj:*/bin/bash
+   fun:virTestMain
+   fun:main
 }
 {
-   bashMemoryLeak3
+   commandtest
    Memcheck:Leak
-   fun:malloc
-   fun:xmalloc
-   fun:array_create
-   fun:array_copy
-   fun:run_exit_trap
-   fun:exit_shell
-   ...
-   obj:*/bin/bash
+   match-leak-kinds: possible
+   fun:calloc
+   fun:allocate_dtv
+   fun:_dl_allocate_tls
+   fun:pthread_create@@GLIBC_2.34
+   fun:virThreadCreateFull
+   fun:virCommandRunAsync
+   fun:test21
+   fun:virTestRun
+   fun:mymain
+   fun:virTestMain
+   fun:main
 }
 {
-   bashMemoryLeak4
+   eventtest
    Memcheck:Leak
-   match-leak-kinds: definite
-   fun:malloc
-   fun:xmalloc
-   fun:set_default_locale
+   match-leak-kinds: possible
+   fun:calloc
+   fun:allocate_dtv
+   fun:_dl_allocate_tls
+   fun:pthread_create@@GLIBC_2.34
+   fun:mymain
+   fun:virTestMain
    fun:main
-   ...
-   obj:*/bin/bash
-}
-#
-# Failure seen in /usr/lib64/ld-2.15.so
-#
-{
-    dlInitMemoryLeak1
-    Memcheck:Leak
-    fun:?alloc
-    ...
-    fun:call_init.part.0
-    fun:_dl_init
-    ...
-    obj:*/lib*/ld-2.*so*
-}
-#
-# Failure seen in
-#  p11_kit_registered_module_to_name: /usr/lib64/libp11-kit.so.0.0.0
-#  gnutls_pkcs11_init: /usr/lib64/libgnutls.so.26.22.4
-#
-{
-    gnutlsInitMemoryLeak
-    Memcheck:Leak
-    fun:malloc
-    fun:strdup
-    fun:p11_kit_registered_module_to_name
-    fun:gnutls_pkcs11_init
-    fun:gnutls_global_init
-    ...
-    obj:*/lib*/libc-2.*so*
-}
-#
-# Failure seen in eventtest, qemumonitorjsontest, qemuhotplugtest,
-#                 qemuagenttest
-#
-{
-    dlAllocateTlsMemoryLeak
-    Memcheck:Leak
-    fun:calloc
-    fun:_dl_allocate_tls
-    fun:pthread_create*
-    ...
-    fun:mymain
-    fun:virtTestMain
-    ...
-    obj:*/lib*/libc-2.*so*
-}
-#
-# commandtest validates the various threaded commands. The
-# virThreadCreate() routine allocates and passes args to the
-# new thread which now owns the 'args' and thus cannot be free'd
-#
-{
-    commandtestLeak1
-    Memcheck:Leak
-    fun:calloc
-    fun:virAlloc
-    fun:virThreadCreate
-    fun:mymain
-    fun:virtTestMain
-}
-#
-# The Error code requires static memory that is never free'd
-# for thread local storage to store error message/data
-#
-{
-    commandtestLeak2
-    Memcheck:Leak
-    fun:calloc
-    fun:virAlloc
-    ...
-    fun:vir*LastError*
-    fun:virEventRunDefaultImpl
-    fun:virCommandThreadWorker
-    fun:virThreadHelper
-    fun:start_thread
-    fun:clone
-}
-#
-# Some of the commandtests (test0, test1, test4, & test18) cause the
-# following traceback although it appears the memory is properly freed
-#
-{
-    commandtestLeak3
-    Memcheck:Leak
-    fun:calloc
-    fun:virAllocN
-    fun:virEventPollRunOnce
-    fun:virEventRunDefaultImpl
-    fun:virCommandThreadWorker
-    fun:virThreadHelper
-    fun:start_thread
-    fun:clone
-}
-#
-# seclabeltest relies on 'selabel_close' which is not in libvirt
-#
-{
-    seclabeltestcond1
-    Memcheck:Cond
-    obj:/usr/lib64/libselinux.so.1
-    fun:selabel_close
-    fun:virSecuritySELinuxSecurityDriverClose
-    fun:virSecurityManagerDispose
-    fun:virObjectUnref
-    fun:main
-}
-#
-# types registered with GLib are never freed
-#
-{
-    glibTypeRegisterLeak
-    Memcheck:Leak
-    match-leak-kinds: possible
-    ...
-    fun:g_realloc
-    obj:*/lib*/libgobject*
-    fun:g_type_register_static
-    ...
 }
-- 
2.41.0
Re: [PATCH 2/2] tests: Refresh valgrind suppressions
Posted by Peter Krempa 2 years, 6 months ago
On Tue, Jul 18, 2023 at 14:28:57 +0200, Michal Privoznik wrote:
> Since nobody is expected to run valgrind over scripts now, we can
> drop plenty of suppressions. Also, there are some old ones that
> no longer exist and new ones, that are not covered.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tests/.valgrind.supp | 188 ++++++++++---------------------------------
>  1 file changed, 41 insertions(+), 147 deletions(-)

Is it really worth keeping this file in the repository? I don't think
we can keep it current.
Re: [PATCH 2/2] tests: Refresh valgrind suppressions
Posted by Michal Prívozník 2 years, 6 months ago
On 7/19/23 12:50, Peter Krempa wrote:
> On Tue, Jul 18, 2023 at 14:28:57 +0200, Michal Privoznik wrote:
>> Since nobody is expected to run valgrind over scripts now, we can
>> drop plenty of suppressions. Also, there are some old ones that
>> no longer exist and new ones, that are not covered.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>>  tests/.valgrind.supp | 188 ++++++++++---------------------------------
>>  1 file changed, 41 insertions(+), 147 deletions(-)
> 
> Is it really worth keeping this file in the repository? I don't think
> we can keep it current.
> 

We have valgrind test setup (add_test_setup() in tests/meson.build) that
passes this file. What we could have is a configure option that
specifies where the file is so that everybody can keep a copy specific
to their system. Would that work?

Michal
Re: [PATCH 2/2] tests: Refresh valgrind suppressions
Posted by Peter Krempa 2 years, 6 months ago
On Wed, Jul 19, 2023 at 14:31:24 +0200, Michal Prívozník wrote:
> On 7/19/23 12:50, Peter Krempa wrote:
> > On Tue, Jul 18, 2023 at 14:28:57 +0200, Michal Privoznik wrote:
> >> Since nobody is expected to run valgrind over scripts now, we can
> >> drop plenty of suppressions. Also, there are some old ones that
> >> no longer exist and new ones, that are not covered.
> >>
> >> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> >> ---
> >>  tests/.valgrind.supp | 188 ++++++++++---------------------------------
> >>  1 file changed, 41 insertions(+), 147 deletions(-)
> > 
> > Is it really worth keeping this file in the repository? I don't think
> > we can keep it current.
> > 
> 
> We have valgrind test setup (add_test_setup() in tests/meson.build) that
> passes this file. What we could have is a configure option that
> specifies where the file is so that everybody can keep a copy specific
> to their system. Would that work?

If we invoke it from the testsuite then I guess it makes sense to
distribute it. Arguably we could make it empty or contain a comment
saying what to put there.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>