From c9b01b60a0689ac305203a66fb3aa04e3c04f7f0 Mon Sep 17 00:00:00 2001 From: Alex Myers Date: Tue, 11 Feb 2025 15:31:50 -0600 Subject: [PATCH] unit-tests: cleanup traces after testing Otherwise it appears to be a leak: ==612637== 11,264 bytes in 1 blocks are still reachable in loss record 1 of 1 ==612637== at 0x484D953: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so) ==612637== by 0x1301F2: trace_init (trace.c:153) ==612637== by 0x13065D: trace_span_start (trace.c:263) ==612637== by 0x173968: db_open_ (utils.c:367) ==612637== by 0x17AE43: create_test_wallet (run-wallet.c:1313) ==612637== by 0x17C726: test_shachain_crud (run-wallet.c:1548) ==612637== by 0x18300E: main (run-wallet.c:2329) Changelog-None --- plugins/bkpr/test/run-bkpr_db.c | 1 + plugins/bkpr/test/run-recorder.c | 1 + wallet/test/run-db.c | 3 ++- wallet/test/run-wallet.c | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/bkpr/test/run-bkpr_db.c b/plugins/bkpr/test/run-bkpr_db.c index 91d4e0271..10ba59aea 100644 --- a/plugins/bkpr/test/run-bkpr_db.c +++ b/plugins/bkpr/test/run-bkpr_db.c @@ -323,5 +323,6 @@ int main(int argc, char *argv[]) tal_free(plugin); common_shutdown(); + trace_cleanup(); return !ok; } diff --git a/plugins/bkpr/test/run-recorder.c b/plugins/bkpr/test/run-recorder.c index 25774f44b..16cd8e9b7 100644 --- a/plugins/bkpr/test/run-recorder.c +++ b/plugins/bkpr/test/run-recorder.c @@ -1430,5 +1430,6 @@ int main(int argc, char *argv[]) tal_free(plugin); common_shutdown(); + trace_cleanup(); return !ok; } diff --git a/wallet/test/run-db.c b/wallet/test/run-db.c index e1a5e150b..d709a47ca 100644 --- a/wallet/test/run-db.c +++ b/wallet/test/run-db.c @@ -1,5 +1,5 @@ #include "config.h" - #include +#include static void db_log_(struct logger *log UNUSED, enum log_level level UNUSED, const struct node_id *node_id UNUSED, bool call_notifier UNUSED, const char *fmt UNUSED, ...) { @@ -544,5 +544,6 @@ int main(int argc, char *argv[]) tal_free(ld); common_shutdown(); + trace_cleanup(); return !ok; } diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index 33ef2ba5f..c6c7aa803 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -2341,6 +2341,7 @@ int main(int argc, const char *argv[]) * database. */ if (ok) { common_shutdown(); + trace_cleanup(); } return !ok; }