summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/developer/topotests.rst13
-rwxr-xr-xtests/topotests/conftest.py6
-rw-r--r--tests/topotests/lib/topotest.py3
3 files changed, 17 insertions, 5 deletions
diff --git a/doc/developer/topotests.rst b/doc/developer/topotests.rst
index 35c2bd4202..2df0107889 100644
--- a/doc/developer/topotests.rst
+++ b/doc/developer/topotests.rst
@@ -639,11 +639,14 @@ Detecting Memleaks with Valgrind
""""""""""""""""""""""""""""""""
Topotest can automatically launch all daemons with ``valgrind`` to check for
-memleaks. This is enabled by specifying 1 or 2 CLI arguments.
-``--valgrind-memleaks`` will enable general memleak detection, and
-``--valgrind-extra`` enables extra functionality including generating a
-suppression file. The suppression file ``tools/valgrind.supp`` is used when
-memleak detection is enabled.
+memleaks. This is enabled by specifying 1 to 3 CLI arguments.
+``--valgrind-memleaks`` enables memleak detection. ``--valgrind-extra`` enables
+extra functionality including generating a suppression file. The suppression
+file ``tools/valgrind.supp`` is used when memleak detection is enabled. Finally,
+``--valgrind-leak-kinds=KINDS`` can be used to modify what types of links are
+reported. This corresponds to valgrind's ``--show-link-kinds`` arg. The value is
+either ``all`` or a comma-separated list of types:
+``definite,indirect,possible,reachable``. The default is ``definite,possible``.
.. code:: shell
diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py
index b6b2880db8..d4ab573dde 100755
--- a/tests/topotests/conftest.py
+++ b/tests/topotests/conftest.py
@@ -209,6 +209,12 @@ def pytest_addoption(parser):
)
parser.addoption(
+ "--valgrind-leak-kinds",
+ metavar="KIND[,KIND...]",
+ help="Comma-separated list of valgrind leak kinds or 'all'",
+ )
+
+ parser.addoption(
"--valgrind-memleaks",
action="store_true",
help="Run all daemons under valgrind for memleak detection",
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index 3eb808ac4f..04c285a053 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -1806,6 +1806,7 @@ class Router(Node):
gdb_routers = g_pytest_config.get_option_list("--gdb-routers")
gdb_use_emacs = bool(g_pytest_config.option.gdb_use_emacs)
valgrind_extra = bool(g_pytest_config.option.valgrind_extra)
+ valgrind_leak_kinds = g_pytest_config.option.valgrind_leak_kinds
valgrind_memleaks = bool(g_pytest_config.option.valgrind_memleaks)
strace_daemons = g_pytest_config.get_option_list("--strace-daemons")
@@ -1938,6 +1939,8 @@ class Router(Node):
f" --log-file={valgrind_logbase}.%p"
f" --leak-check=full --suppressions={supp_file}"
)
+ if valgrind_leak_kinds:
+ cmdenv += f" --show-leak-kinds={valgrind_leak_kinds}"
if valgrind_extra:
cmdenv += (
" --gen-suppressions=all --expensive-definedness-checks=yes"