diff options
author | Samuel Dobson <dobsonsa68@gmail.com> | 2020-11-02 11:40:57 +1300 |
---|---|---|
committer | Samuel Dobson <dobsonsa68@gmail.com> | 2020-11-02 11:41:38 +1300 |
commit | 5a6f3c5a01eaf904c42bd77dbed931b49a8fec74 (patch) | |
tree | c1720bc760aa557f3e404a3dbc065c25df7cdb3c /src/test | |
parent | 42b66a6b814bca130a9ccf0a3f747cf33d628232 (diff) | |
parent | ad5cef5dfdd5802fc187a52e74d940a52f420a51 (diff) |
Merge #20080: Strip any trailing `/` in -datadir and -blocksdir paths
ad5cef5dfdd5802fc187a52e74d940a52f420a51 doc: Update data directory path comments (Hennadii Stepanov)
b19e88230f0e93e95e883e65376963cb9c36f606 util: Add StripRedundantLastElementsOfPath function (Hennadii Stepanov)
Pull request description:
Wallet names in `listwalletdir` RPC are correct now, even if the `-datadir` path has any number of trailing `/`.
This PR is an alternative to #19933.
Fixes #19928.
ACKs for top commit:
MarcoFalke:
review ACK ad5cef5dfd 🔙
promag:
Code review ACK ad5cef5dfdd5802fc187a52e74d940a52f420a51.
meshcollider:
Code review + test run ACK ad5cef5dfdd5802fc187a52e74d940a52f420a51
Tree-SHA512: bccabbd6c18243d48d15b2b27201cc0f5984623dcbc635c8740cf74523f359844c36eadd40391142874fcf452a43880bb6afbf89815ae736e499f9a98143a661
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/util_tests.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 241c56934e..010b6adf1f 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -42,6 +42,28 @@ namespace BCLog { BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup) +BOOST_AUTO_TEST_CASE(util_datadir) +{ + ClearDatadirCache(); + const fs::path dd_norm = GetDataDir(); + + gArgs.ForceSetArg("-datadir", dd_norm.string() + "/"); + ClearDatadirCache(); + BOOST_CHECK_EQUAL(dd_norm, GetDataDir()); + + gArgs.ForceSetArg("-datadir", dd_norm.string() + "/."); + ClearDatadirCache(); + BOOST_CHECK_EQUAL(dd_norm, GetDataDir()); + + gArgs.ForceSetArg("-datadir", dd_norm.string() + "/./"); + ClearDatadirCache(); + BOOST_CHECK_EQUAL(dd_norm, GetDataDir()); + + gArgs.ForceSetArg("-datadir", dd_norm.string() + "/.//"); + ClearDatadirCache(); + BOOST_CHECK_EQUAL(dd_norm, GetDataDir()); +} + BOOST_AUTO_TEST_CASE(util_check) { // Check that Assert can forward |