unit tests: don't crash if !HAVE_SQLITE3.

Fixes: #4928
Reported-by: @whitslack
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-03-28 10:58:12 +10:30
parent 0c3aa355db
commit 5cb4705eb4
2 changed files with 19 additions and 13 deletions

View File

@ -262,10 +262,13 @@ int main(int argc, char *argv[])
common_setup(argv[0]); common_setup(argv[0]);
ld->config = test_config; ld->config = test_config;
ok &= test_empty_db_migrate(ld); /* We do a runtime test here, so we still check compile! */
ok &= test_vars(ld); if (HAVE_SQLITE3) {
ok &= test_primitives(); ok &= test_empty_db_migrate(ld);
ok &= test_manip_columns(); ok &= test_vars(ld);
ok &= test_primitives();
ok &= test_manip_columns();
}
tal_free(ld); tal_free(ld);
common_shutdown(); common_shutdown();

View File

@ -1906,15 +1906,18 @@ int main(int argc, const char *argv[])
htlc_in_map_init(&ld->htlcs_in); htlc_in_map_init(&ld->htlcs_in);
htlc_out_map_init(&ld->htlcs_out); htlc_out_map_init(&ld->htlcs_out);
ok &= test_shachain_crud(ld, tmpctx); /* We do a runtime test here, so we still check compile! */
ok &= test_channel_crud(ld, tmpctx); if (HAVE_SQLITE3) {
ok &= test_channel_inflight_crud(ld, tmpctx); ok &= test_shachain_crud(ld, tmpctx);
ok &= test_channel_config_crud(ld, tmpctx); ok &= test_channel_crud(ld, tmpctx);
ok &= test_channel_inflight_crud(ld, tmpctx); ok &= test_channel_inflight_crud(ld, tmpctx);
ok &= test_wallet_outputs(ld, tmpctx); ok &= test_channel_config_crud(ld, tmpctx);
ok &= test_htlc_crud(ld, tmpctx); ok &= test_channel_inflight_crud(ld, tmpctx);
ok &= test_payment_crud(ld, tmpctx); ok &= test_wallet_outputs(ld, tmpctx);
ok &= test_wallet_payment_status_enum(); ok &= test_htlc_crud(ld, tmpctx);
ok &= test_payment_crud(ld, tmpctx);
ok &= test_wallet_payment_status_enum();
}
/* Do not clean up in the case of an error, we might want to debug the /* Do not clean up in the case of an error, we might want to debug the
* database. */ * database. */