mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
lightningd/test: use tmpdir_mkstemp() to create log file
Changelog-None
This commit is contained in:
parent
2d904d3655
commit
7c582944bd
1 changed files with 4 additions and 4 deletions
|
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
||||||
struct log_book *lb;
|
struct log_book *lb;
|
||||||
struct node_id node_id;
|
struct node_id node_id;
|
||||||
struct lightningd *ld;
|
struct lightningd *ld;
|
||||||
char tmpfiletemplate[] = "/tmp/run-log_filter.XXXXXX";
|
char *tmpfile;
|
||||||
|
|
||||||
common_setup(argv[0]);
|
common_setup(argv[0]);
|
||||||
|
|
||||||
|
@ -131,8 +131,8 @@ int main(int argc, char *argv[])
|
||||||
ld->log = new_logger(ld, lb, NULL, "dummy");
|
ld->log = new_logger(ld, lb, NULL, "dummy");
|
||||||
assert(arg_log_to_file("-", ld) == NULL);
|
assert(arg_log_to_file("-", ld) == NULL);
|
||||||
|
|
||||||
assert(mkstemp(tmpfiletemplate) >= 0);
|
assert(tmpdir_mkstemp(tmpctx, "run-log_filter.XXXXXX", &tmpfile) >= 0);
|
||||||
assert(arg_log_to_file(tmpfiletemplate, ld) == NULL);
|
assert(arg_log_to_file(tmpfile, ld) == NULL);
|
||||||
|
|
||||||
/* Log level default. */
|
/* Log level default. */
|
||||||
assert(opt_log_level("BROKEN", lb) == NULL);
|
assert(opt_log_level("BROKEN", lb) == NULL);
|
||||||
|
@ -224,7 +224,7 @@ int main(int argc, char *argv[])
|
||||||
assert(try_log(lb, "prefix", NULL, LOG_IO_IN) == 0);
|
assert(try_log(lb, "prefix", NULL, LOG_IO_IN) == 0);
|
||||||
|
|
||||||
/* File exception: tmpfile logs everything */
|
/* File exception: tmpfile logs everything */
|
||||||
assert(opt_log_level(tal_fmt(tmpctx, "io::%s", tmpfiletemplate), lb) == NULL);
|
assert(opt_log_level(tal_fmt(tmpctx, "io::%s", tmpfile), lb) == NULL);
|
||||||
assert(try_log(lb, "stdout1", NULL, LOG_BROKEN) == 2);
|
assert(try_log(lb, "stdout1", NULL, LOG_BROKEN) == 2);
|
||||||
assert(try_log(lb, "stdout1", NULL, LOG_INFORM) == 2);
|
assert(try_log(lb, "stdout1", NULL, LOG_INFORM) == 2);
|
||||||
assert(try_log(lb, "stdout1", NULL, LOG_DBG) == 2);
|
assert(try_log(lb, "stdout1", NULL, LOG_DBG) == 2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue