tests: use common_setup/common_shutdown to avoid leaks.

It also does more checks (like taken() checks).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-11-15 04:22:46 +10:30
parent 68043c2e8c
commit 57328fe59e
17 changed files with 60 additions and 54 deletions

View File

@@ -4,6 +4,7 @@
#include <common/channel_id.h>
#include <common/json_stream.h>
#include <common/node_id.h>
#include <common/setup.h>
#include <fcntl.h>
#include <sys/socket.h>
@@ -171,7 +172,7 @@ ssize_t test_read(int fd UNUSED, void *buf, size_t len)
int main(int argc UNUSED, char *argv[])
{
setup_locale();
common_setup(argv[0]);
char *fake_argv[] = { argv[0], "--lightning-dir=/tmp/", "test", "-N", "none", NULL };
@@ -200,7 +201,6 @@ int main(int argc UNUSED, char *argv[])
max_read_return = -1;
assert(test_main(5, fake_argv) == 0);
tal_free(response);
assert(!taken_any());
take_cleanup();
common_shutdown();
return 0;
}