diff --git a/src/test/dbwrapper_tests.cpp b/src/test/dbwrapper_tests.cpp --- a/src/test/dbwrapper_tests.cpp +++ b/src/test/dbwrapper_tests.cpp @@ -28,8 +28,9 @@ BOOST_AUTO_TEST_CASE(dbwrapper) { // Perform tests both obfuscated and non-obfuscated. for (const bool obfuscate : {false, true}) { - fs::path ph = GetDataDir() / (obfuscate ? "dbwrapper_obfuscate_true" - : "dbwrapper_obfuscate_false"); + fs::path ph = + m_args.GetDataDirPath() / (obfuscate ? "dbwrapper_obfuscate_true" + : "dbwrapper_obfuscate_false"); CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); char key = 'k'; uint256 in = InsecureRand256(); @@ -48,9 +49,9 @@ BOOST_AUTO_TEST_CASE(dbwrapper_basic_data) { // Perform tests both obfuscated and non-obfuscated. for (bool obfuscate : {false, true}) { - fs::path ph = - GetDataDir() / (obfuscate ? "dbwrapper_1_obfuscate_true" - : "dbwrapper_1_obfuscate_false"); + fs::path ph = m_args.GetDataDirPath() / + (obfuscate ? "dbwrapper_1_obfuscate_true" + : "dbwrapper_1_obfuscate_false"); CDBWrapper dbw(ph, (1 << 20), false, true, obfuscate); uint256 res; @@ -132,9 +133,9 @@ BOOST_AUTO_TEST_CASE(dbwrapper_batch) { // Perform tests both obfuscated and non-obfuscated. for (const bool obfuscate : {false, true}) { - fs::path ph = - GetDataDir() / (obfuscate ? "dbwrapper_batch_obfuscate_true" - : "dbwrapper_batch_obfuscate_false"); + fs::path ph = m_args.GetDataDirPath() / + (obfuscate ? "dbwrapper_batch_obfuscate_true" + : "dbwrapper_batch_obfuscate_false"); CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); char key = 'i'; @@ -169,9 +170,9 @@ BOOST_AUTO_TEST_CASE(dbwrapper_iterator) { // Perform tests both obfuscated and non-obfuscated. for (const bool obfuscate : {false, true}) { - fs::path ph = - GetDataDir() / (obfuscate ? "dbwrapper_iterator_obfuscate_true" - : "dbwrapper_iterator_obfuscate_false"); + fs::path ph = m_args.GetDataDirPath() / + (obfuscate ? "dbwrapper_iterator_obfuscate_true" + : "dbwrapper_iterator_obfuscate_false"); CDBWrapper dbw(ph, (1 << 20), true, false, obfuscate); // The two keys are intentionally chosen for ordering @@ -211,7 +212,7 @@ // Test that we do not obfuscation if there is existing data. BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate) { // We're going to share this fs::path between two wrappers - fs::path ph = GetDataDir() / "existing_data_no_obfuscate"; + fs::path ph = m_args.GetDataDirPath() / "existing_data_no_obfuscate"; create_directories(ph); // Set up a non-obfuscated wrapper to write some initial data. @@ -254,7 +255,7 @@ // Ensure that we start obfuscating during a reindex. BOOST_AUTO_TEST_CASE(existing_data_reindex) { // We're going to share this fs::path between two wrappers - fs::path ph = GetDataDir() / "existing_data_reindex"; + fs::path ph = m_args.GetDataDirPath() / "existing_data_reindex"; create_directories(ph); // Set up a non-obfuscated wrapper to write some initial data. @@ -289,7 +290,7 @@ } BOOST_AUTO_TEST_CASE(iterator_ordering) { - fs::path ph = GetDataDir() / "iterator_ordering"; + fs::path ph = m_args.GetDataDirPath() / "iterator_ordering"; CDBWrapper dbw(ph, (1 << 20), true, false, false); for (int x = 0x00; x < 256; ++x) { uint8_t key = x; @@ -374,7 +375,7 @@ BOOST_AUTO_TEST_CASE(iterator_string_ordering) { char buf[10]; - fs::path ph = GetDataDir() / "iterator_string_ordering"; + fs::path ph = m_args.GetDataDirPath() / "iterator_string_ordering"; CDBWrapper dbw(ph, (1 << 20), true, false, false); for (int x = 0x00; x < 10; ++x) { for (int y = 0; y < 10; y++) { @@ -425,7 +426,8 @@ // On Windows this test will fail if the directory is created using // the ANSI CreateDirectoryA call and the code page isn't UTF8. // It will succeed if created with CreateDirectoryW. - fs::path ph = GetDataDir() / "test_runner_₿_🏃_20191128_104644"; + fs::path ph = + m_args.GetDataDirPath() / "test_runner_₿_🏃_20191128_104644"; CDBWrapper dbw(ph, (1 << 20)); fs::path lockPath = ph / "LOCK"; diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp --- a/src/test/denialofservice_tests.cpp +++ b/src/test/denialofservice_tests.cpp @@ -237,9 +237,9 @@ const Config &config = GetConfig(); std::atomic interruptDummy(false); - auto banman = std::make_unique(GetDataDir() / "banlist.dat", - config.GetChainParams(), nullptr, - DEFAULT_MISBEHAVING_BANTIME); + auto banman = std::make_unique( + m_args.GetDataDirPath() / "banlist.dat", config.GetChainParams(), + nullptr, DEFAULT_MISBEHAVING_BANTIME); auto connman = std::make_unique(config, 0x1337, 0x1337); auto peerLogic = std::make_unique( config.GetChainParams(), *connman, banman.get(), *m_node.scheduler, @@ -300,9 +300,9 @@ const Config &config = GetConfig(); std::atomic interruptDummy(false); - auto banman = std::make_unique(GetDataDir() / "banlist.dat", - config.GetChainParams(), nullptr, - DEFAULT_MISBEHAVING_BANTIME); + auto banman = std::make_unique( + m_args.GetDataDirPath() / "banlist.dat", config.GetChainParams(), + nullptr, DEFAULT_MISBEHAVING_BANTIME); auto connman = std::make_unique(config, 0x1337, 0x1337); auto peerLogic = std::make_unique( config.GetChainParams(), *connman, banman.get(), *m_node.scheduler, diff --git a/src/test/flatfile_tests.cpp b/src/test/flatfile_tests.cpp --- a/src/test/flatfile_tests.cpp +++ b/src/test/flatfile_tests.cpp @@ -15,7 +15,7 @@ BOOST_FIXTURE_TEST_SUITE(flatfile_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(flatfile_filename) { - const auto data_dir = GetDataDir(); + const auto data_dir = m_args.GetDataDirPath(); FlatFilePos pos(456, 789); @@ -27,7 +27,7 @@ } BOOST_AUTO_TEST_CASE(flatfile_open) { - const auto data_dir = GetDataDir(); + const auto data_dir = m_args.GetDataDirPath(); FlatFileSeq seq(data_dir, "a", 16 * 1024); std::string line1( @@ -97,7 +97,7 @@ } BOOST_AUTO_TEST_CASE(flatfile_allocate) { - const auto data_dir = GetDataDir(); + const auto data_dir = m_args.GetDataDirPath(); FlatFileSeq seq(data_dir, "a", 100); bool out_of_space; @@ -116,7 +116,7 @@ } BOOST_AUTO_TEST_CASE(flatfile_flush) { - const auto data_dir = GetDataDir(); + const auto data_dir = m_args.GetDataDirPath(); FlatFileSeq seq(data_dir, "a", 100); bool out_of_space; diff --git a/src/test/fs_tests.cpp b/src/test/fs_tests.cpp --- a/src/test/fs_tests.cpp +++ b/src/test/fs_tests.cpp @@ -13,7 +13,7 @@ BOOST_FIXTURE_TEST_SUITE(fs_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(fsbridge_fstream) { - fs::path tmpfolder = GetDataDir(); + fs::path tmpfolder = m_args.GetDataDirPath(); // tmpfile1 should be the same as tmpfile2 fs::path tmpfile1 = tmpfolder / "fs_tests_₿_🏃"; fs::path tmpfile2 = tmpfolder / "fs_tests_₿_🏃"; diff --git a/src/test/settings_tests.cpp b/src/test/settings_tests.cpp --- a/src/test/settings_tests.cpp +++ b/src/test/settings_tests.cpp @@ -45,7 +45,7 @@ BOOST_FIXTURE_TEST_SUITE(settings_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(ReadWrite) { - fs::path path = GetDataDir() / "settings.json"; + fs::path path = m_args.GetDataDirPath() / "settings.json"; WriteText(path, R"({ "string": "string", diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -2002,7 +2002,7 @@ #endif BOOST_AUTO_TEST_CASE(test_LockDirectory) { - fs::path dirname = GetDataDir() / "lock_dir"; + fs::path dirname = m_args.GetDataDirPath() / "lock_dir"; const std::string lockname = ".lock"; #ifndef WIN32 // Revert SIGCHLD to default, otherwise boost.test will catch and fail on @@ -2093,7 +2093,7 @@ BOOST_AUTO_TEST_CASE(test_DirIsWritable) { // Should be able to write to the data dir. - fs::path tmpdirname = GetDataDir(); + fs::path tmpdirname = m_args.GetDataDirPath(); BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), true); // Should not be able to write to a non-existent dir.