mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-12 18:49:42 +01:00
renepay: clean unit tests
Delete temporary gossmap files after unit tests completion. Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
This commit is contained in:
parent
638fff8526
commit
abfcc9bc5d
5 changed files with 15 additions and 6 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue