Skip to content
Snippets Groups Projects
Commit b18fcde8 authored by Simon McVittie's avatar Simon McVittie
Browse files

tests: Add support for running C subprocesses under valgrind


This is helpful when tracking down leaks.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 8d699641
No related branches found
No related tags found
No related merge requests found
{
Class initialization
Memcheck:Leak
match-leak-kinds:possible
...
fun:g_type_class_ref
}
{
GDBus thread
Memcheck:Leak
match-leak-kinds:possible
...
fun:pthread_create@*
...
fun:g_bus_get_sync
}
{
Thread stack
Memcheck:Leak
match-leak-kinds:possible
...
fun:allocate_stack
fun:pthread_create@*
}
{
GObject library init
Memcheck:Leak
match-leak-kinds:possible
...
obj:/usr/lib*/libgobject-2.0.so.0.*
...
fun:call_init
fun:_dl_init
}
......@@ -123,6 +123,29 @@ class BaseTest(unittest.TestCase):
self.tmpdir = tempfile.TemporaryDirectory()
self.addCleanup(self.tmpdir.cleanup)
if 'PRESSURE_VESSEL_TEST_MEMCHECK' in os.environ:
self.command_prefix = [
'valgrind',
'--child-silent-after-fork=yes',
'--gen-suppressions=all',
'--leak-check=full',
'--leak-resolution=high',
'--num-callers=20',
'--tool=memcheck',
'--verbose',
]
for supp in (
os.path.join(self.top_srcdir, 'tests', 'pressure-vessel.supp'),
'/usr/share/glib-2.0/valgrind/glib.supp',
):
if os.path.isfile(supp):
self.command_prefix.append(
'--suppressions=' + supp,
)
else:
self.command_prefix = []
def tearDown(self) -> None:
pass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment