diff --git a/plugins/renepay/test/run-bottleneck.c b/plugins/renepay/test/run-bottleneck.c index 25d0f80c7..423535cf5 100644 --- a/plugins/renepay/test/run-bottleneck.c +++ b/plugins/renepay/test/run-bottleneck.c @@ -56,6 +56,8 @@ static const char *print_flows(const tal_t *ctx, const char *desc, #define NUM_NODES 8 +static void remove_file(char *fname) { assert(!remove(fname)); } + int main(int argc, char *argv[]) { int fd; @@ -67,6 +69,7 @@ int main(int argc, char *argv[]) chainparams = chainparams_for_network("regtest"); fd = tmpdir_mkstemp(tmpctx, "run-bottleneck.XXXXXX", &gossfile); + tal_add_destructor(gossfile, remove_file); assert(write(fd, empty_map, sizeof(empty_map)) == sizeof(empty_map)); gossmap = gossmap_load(tmpctx, gossfile, NULL); diff --git a/plugins/renepay/test/run-mcf-diamond.c b/plugins/renepay/test/run-mcf-diamond.c index e8b5c5d15..11141af7b 100644 --- a/plugins/renepay/test/run-mcf-diamond.c +++ b/plugins/renepay/test/run-mcf-diamond.c @@ -93,6 +93,8 @@ static const char* print_flows( return buff; } +static void remove_file(char *fname) { assert(!remove(fname)); } + int main(int argc, char *argv[]) { int fd; @@ -108,6 +110,7 @@ int main(int argc, char *argv[]) common_setup(argv[0]); fd = tmpdir_mkstemp(tmpctx, "run-not_mcf-diamond.XXXXXX", &gossfile); + tal_add_destructor(gossfile, remove_file); assert(write_all(fd, empty_map, sizeof(empty_map))); gossmap = gossmap_load(tmpctx, gossfile, NULL); diff --git a/plugins/renepay/test/run-mcf.c b/plugins/renepay/test/run-mcf.c index ab0774d5e..29d11172f 100644 --- a/plugins/renepay/test/run-mcf.c +++ b/plugins/renepay/test/run-mcf.c @@ -341,6 +341,8 @@ static const char *print_flows( return buff; } +static void remove_file(char *fname) { assert(!remove(fname)); } + int main(int argc, char *argv[]) { int fd; @@ -362,11 +364,11 @@ int main(int argc, char *argv[]) common_setup(argv[0]); fd = tmpdir_mkstemp(tmpctx, "run-not_mcf.XXXXXX", &gossfile); + tal_add_destructor(gossfile, remove_file); assert(write_all(fd, canned_map, sizeof(canned_map))); gossmap = gossmap_load(tmpctx, gossfile, NULL); assert(gossmap); - remove(gossfile); /* There is a public channel 2<->3 (103x1x0), and 1<->2 (110x1x1). */ assert(node_id_from_hexstr("0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518", 66, &l1)); diff --git a/plugins/renepay/test/run-missingcapacity.c b/plugins/renepay/test/run-missingcapacity.c index 3e27a3117..fa0b4c7e8 100644 --- a/plugins/renepay/test/run-missingcapacity.c +++ b/plugins/renepay/test/run-missingcapacity.c @@ -24,6 +24,8 @@ static u8 empty_map[] = {10}; #define NUM_NODES 4 +static void remove_file(char *fname) { assert(!remove(fname)); } + int main(int argc, char *argv[]) { int fd; @@ -35,6 +37,7 @@ int main(int argc, char *argv[]) chainparams = chainparams_for_network("regtest"); fd = tmpdir_mkstemp(tmpctx, "run-missingcapacity.XXXXXX", &gossfile); + tal_add_destructor(gossfile, remove_file); assert(write(fd, empty_map, sizeof(empty_map)) == sizeof(empty_map)); gossmap = gossmap_load(tmpctx, gossfile, NULL); @@ -162,6 +165,7 @@ int main(int argc, char *argv[]) assert(node_id_eq(&routes[0]->hops[0].node_id, &nodes[1])); assert(node_id_eq(&routes[0]->hops[1].node_id, &nodes[3])); } + common_shutdown(); } diff --git a/plugins/renepay/test/run-testflow.c b/plugins/renepay/test/run-testflow.c index c974eeca4..66a9e018a 100644 --- a/plugins/renepay/test/run-testflow.c +++ b/plugins/renepay/test/run-testflow.c @@ -517,10 +517,7 @@ static void test_edge_probability(void) assert(fabs(edge_probability(min,max,X,f)-0.0)< eps); } -static void remove_file(char *fname) -{ - assert(!remove(fname)); -} +static void remove_file(char *fname) { assert(!remove(fname)); } static void test_flow_to_route(void) { @@ -530,7 +527,7 @@ static void test_flow_to_route(void) char *gossfile; int fd = tmpdir_mkstemp(this_ctx,"run-testflow.XXXXXX",&gossfile); - tal_add_destructor(gossfile,remove_file); + tal_add_destructor(gossfile, remove_file); assert(write_all(fd,canned_map,sizeof(canned_map))); struct gossmap *gossmap = gossmap_load(this_ctx,gossfile,NULL);