From dfa325dc4dc711479cbc7f9402e96e46b26950d8 Mon Sep 17 00:00:00 2001 From: niftynei Date: Sun, 31 Jul 2022 13:03:04 -0500 Subject: [PATCH] bkpr: make unit tests not fail if !HAVE_SQLITE3 We rely on sqlite3 being present to run unit tests for some bookkeeper tests; here we effectively disable these tests if not available Fixes report in #4928 Reported-By: @whitslack --- plugins/bkpr/test/run-bkpr_db.c | 4 +++- plugins/bkpr/test/run-recorder.c | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/bkpr/test/run-bkpr_db.c b/plugins/bkpr/test/run-bkpr_db.c index 09116bcb0..dae035240 100644 --- a/plugins/bkpr/test/run-bkpr_db.c +++ b/plugins/bkpr/test/run-bkpr_db.c @@ -292,7 +292,9 @@ int main(int argc, char *argv[]) common_setup(argv[0]); - ok &= test_db_migrate(plugin); + if (HAVE_SQLITE3) { + ok &= test_db_migrate(plugin); + } tal_free(plugin); common_shutdown(); diff --git a/plugins/bkpr/test/run-recorder.c b/plugins/bkpr/test/run-recorder.c index 762b99dbb..e2380b1a3 100644 --- a/plugins/bkpr/test/run-recorder.c +++ b/plugins/bkpr/test/run-recorder.c @@ -1315,13 +1315,15 @@ int main(int argc, char *argv[]) common_setup(argv[0]); - ok &= test_account_crud(tmpctx, plugin); - ok &= test_channel_event_crud(tmpctx, plugin); - ok &= test_chain_event_crud(tmpctx, plugin); - ok &= test_account_balances(tmpctx, plugin); - ok &= test_onchain_fee_chan_close(tmpctx, plugin); - ok &= test_onchain_fee_chan_open(tmpctx, plugin); - ok &= test_onchain_fee_wallet_spend(tmpctx, plugin); + if (HAVE_SQLITE3) { + ok &= test_account_crud(tmpctx, plugin); + ok &= test_channel_event_crud(tmpctx, plugin); + ok &= test_chain_event_crud(tmpctx, plugin); + ok &= test_account_balances(tmpctx, plugin); + ok &= test_onchain_fee_chan_close(tmpctx, plugin); + ok &= test_onchain_fee_chan_open(tmpctx, plugin); + ok &= test_onchain_fee_wallet_spend(tmpctx, plugin); + } tal_free(plugin); common_shutdown();