mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Provide relevant error message if datadir is not writable.
This commit is contained in:
@@ -800,4 +800,20 @@ BOOST_AUTO_TEST_CASE(test_LockDirectory)
|
||||
fs::remove_all(dirname);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_DirIsWritable)
|
||||
{
|
||||
// Should be able to write to the system tmp dir.
|
||||
fs::path tmpdirname = fs::temp_directory_path();
|
||||
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), true);
|
||||
|
||||
// Should not be able to write to a non-existent dir.
|
||||
tmpdirname = fs::temp_directory_path() / fs::unique_path();
|
||||
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), false);
|
||||
|
||||
fs::create_directory(tmpdirname);
|
||||
// Should be able to write to it now.
|
||||
BOOST_CHECK_EQUAL(DirIsWritable(tmpdirname), true);
|
||||
fs::remove(tmpdirname);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user