mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
pytest: fix hsmtool which reports leak under address sanitizer.
Couldn't figure out why hsmtool.proc.wait(WAIT_TIMEOUT) returns 1? hsmtool doesn't ever seem to exit status 1! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0741d4dea1
commit
9af01b062c
2 changed files with 11 additions and 4 deletions
|
@ -1338,7 +1338,12 @@ def test_hsmtool_generatehsm(node_factory):
|
|||
"cake have wedding\n".encode("utf-8"))
|
||||
hsmtool.wait_for_log(r"Enter your passphrase:")
|
||||
write_all(master_fd, "This is actually not a passphrase\n".encode("utf-8"))
|
||||
assert hsmtool.proc.wait(WAIT_TIMEOUT) == 0
|
||||
if hsmtool.proc.wait(WAIT_TIMEOUT) != 0:
|
||||
hsmtool.logs_catchup()
|
||||
print("hsmtool failure! Logs:")
|
||||
for l in hsmtool.logs:
|
||||
print(' ' + l)
|
||||
assert False
|
||||
hsmtool.is_in_log(r"New hsm_secret file created")
|
||||
|
||||
# Check should pass.
|
||||
|
|
|
@ -530,7 +530,7 @@ static char *read_mnemonic(void) {
|
|||
|
||||
static int generate_hsm(const char *hsm_secret_path,
|
||||
const char *lang_id,
|
||||
const char *mnemonic,
|
||||
char *mnemonic,
|
||||
char *passphrase)
|
||||
{
|
||||
const char *err;
|
||||
|
@ -584,6 +584,7 @@ static int generate_hsm(const char *hsm_secret_path,
|
|||
printf("New hsm_secret file created at %s\n", hsm_secret_path);
|
||||
printf("Use the `encrypt` command to encrypt the BIP32 seed if needed\n");
|
||||
|
||||
free(mnemonic);
|
||||
free(passphrase);
|
||||
return 0;
|
||||
}
|
||||
|
@ -685,6 +686,7 @@ static int check_hsm(const char *hsm_secret_path)
|
|||
|
||||
printf("OK\n");
|
||||
|
||||
free(mnemonic);
|
||||
free(passphrase);
|
||||
return 0;
|
||||
}
|
||||
|
@ -810,8 +812,8 @@ int main(int argc, char *argv[])
|
|||
if (lang_id && !check_lang(lang_id))
|
||||
show_usage(argv[0]);
|
||||
|
||||
word_list = (argc > 4 ? argv[4] : NULL);
|
||||
/* generate_hsm expects to free this, so use strdup */
|
||||
/* generate_hsm expects to free these, so use strdup */
|
||||
word_list = (argc > 4 ? strdup(argv[4]) : NULL);
|
||||
passphrase = (argc > 5 ? strdup(argv[5]) : NULL);
|
||||
|
||||
return generate_hsm(hsm_secret_path, lang_id, word_list, passphrase);
|
||||
|
|
Loading…
Add table
Reference in a new issue