aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authormurrayn <[email protected]>2018-03-07 03:08:55 -0800
committermurrayn <[email protected]>2018-03-14 19:07:30 -0700
commit8674e74b47c1f6e86a367cfbc738fcc9812b616b (patch)
treeacf9d52938e2021e4dcb9ad1c89e02ae8362d82a /src/test
parentMerge #11372: Address encoding cleanup (diff)
downloaddiscoin-8674e74b47c1f6e86a367cfbc738fcc9812b616b.tar.xz
discoin-8674e74b47c1f6e86a367cfbc738fcc9812b616b.zip
Provide relevant error message if datadir is not writable.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/util_tests.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index 58f033cd8..e750969b6 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -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()