Skip to content

Commit 54115d8

Browse files
committed
Merge bitcoin/bitcoin#31617: build, test: Build db_tests.cpp regardless of USE_BDB
fd2d96d build, test: Build `db_tests.cpp` regardless of `USE_BDB` (Hennadii Stepanov) Pull request description: When the building of `db_tests.cpp` was made conditional on `USE_BDB` in commit a58b719, all `db_tests` were indeed specific to BDB wallets. However, the tests have since been [extended](bitcoin/bitcoin@ba616b9) to include SQLite wallets as well. On the master branch @ 433412f, tests specific to SQLite wallets are not built and run if configured with `WITH_BDB=OFF` (the default option). This PR resolves this issue by guarding BDB-specific code in `db_tests.cpp` and ensuring this source file is compiled regardless of the `WITH_BDB` option. ACKs for top commit: achow101: ACK fd2d96d maflcko: review ACK fd2d96d 🔺 theuni: utACK fd2d96d Tree-SHA512: bd9eddf16af60c568e931467d39e9e23a268e82e367ab630c23ac3cfd37e6007c6d78579b69ccbeebc1911c749cdbe75794fd56d7fbdb30c6fea6d2ab11017a3
2 parents 0a77441 + fd2d96d commit 54115d8

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/wallet/test/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ target_sources(test_bitcoin
88
PRIVATE
99
init_test_fixture.cpp
1010
wallet_test_fixture.cpp
11+
db_tests.cpp
1112
coinselector_tests.cpp
1213
feebumper_tests.cpp
1314
group_outputs_tests.cpp
@@ -22,10 +23,4 @@ target_sources(test_bitcoin
2223
walletdb_tests.cpp
2324
walletload_tests.cpp
2425
)
25-
if(USE_BDB)
26-
target_sources(test_bitcoin
27-
PRIVATE
28-
db_tests.cpp
29-
)
30-
endif()
3126
target_link_libraries(test_bitcoin bitcoin_wallet)

src/wallet/test/db_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static void CheckPrefix(DatabaseBatch& batch, Span<const std::byte> prefix, Mock
6262

6363
BOOST_FIXTURE_TEST_SUITE(db_tests, BasicTestingSetup)
6464

65+
#ifdef USE_BDB
6566
static std::shared_ptr<BerkeleyEnvironment> GetWalletEnv(const fs::path& path, fs::path& database_filename)
6667
{
6768
fs::path data_file = BDBDataFile(path);
@@ -124,6 +125,7 @@ BOOST_AUTO_TEST_CASE(getwalletenv_g_dbenvs_free_instance)
124125
BOOST_CHECK(env_1_a != env_1_b);
125126
BOOST_CHECK(env_2_a == env_2_b);
126127
}
128+
#endif
127129

128130
static std::vector<std::unique_ptr<WalletDatabase>> TestDatabases(const fs::path& path_root)
129131
{

0 commit comments

Comments
 (0)