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
This commit is contained in:
Alex Myers
2025-02-11 15:31:50 -06:00
committed by Alex Myers
parent 39753f1fd6
commit c9b01b60a0
4 changed files with 5 additions and 1 deletions

View File

@@ -323,5 +323,6 @@ int main(int argc, char *argv[])
tal_free(plugin);
common_shutdown();
trace_cleanup();
return !ok;
}

View File

@@ -1430,5 +1430,6 @@ int main(int argc, char *argv[])
tal_free(plugin);
common_shutdown();
trace_cleanup();
return !ok;
}

View File

@@ -1,5 +1,5 @@
#include "config.h"
#include <lightningd/log.h>
#include <lightningd/log.h>
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;
}

View File

@@ -2341,6 +2341,7 @@ int main(int argc, const char *argv[])
* database. */
if (ok) {
common_shutdown();
trace_cleanup();
}
return !ok;
}