This is an automated email from the ASF dual-hosted git repository.
pengzheng pushed a commit to branch feature/refactor_bundle_cache
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to refs/heads/feature/refactor_bundle_cache
by this push:
new 1425913d Add test to create directory with absolute path.
1425913d is described below
commit 1425913d0b097294275c2c3bb46f1c004d1daec4
Author: PengZheng <[email protected]>
AuthorDate: Fri Mar 10 21:36:44 2023 +0800
Add test to create directory with absolute path.
---
libs/utils/gtest/src/FileUtilsTestSuite.cc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libs/utils/gtest/src/FileUtilsTestSuite.cc
b/libs/utils/gtest/src/FileUtilsTestSuite.cc
index 8c3c9e38..53ed616b 100644
--- a/libs/utils/gtest/src/FileUtilsTestSuite.cc
+++ b/libs/utils/gtest/src/FileUtilsTestSuite.cc
@@ -18,6 +18,7 @@
*/
#include <gtest/gtest.h>
+#include <stdlib.h>
#include <string>
#include <thread>
#include <unistd.h>
@@ -86,6 +87,18 @@ TEST_F(FileUtilsTestSuite, CreateAndDeleteDirectory) {
status = celix_utils_deleteDirectory(testDir3, nullptr);
EXPECT_EQ(status, CELIX_SUCCESS);
+ //Can I create and delete a dir that begins with a /
+ auto cwd = getcwd(nullptr, 0);
+ std::string testDir4 = cwd;
+ free(cwd);
+ testDir4 += "/";
+ testDir4 += testDir;
+ status = celix_utils_createDirectory(testDir4.c_str(), true, &error);
+ EXPECT_EQ(status, CELIX_SUCCESS);
+ EXPECT_EQ(error, nullptr);
+ status = celix_utils_deleteDirectory(testDir4.c_str(), nullptr);
+ EXPECT_EQ(status, CELIX_SUCCESS);
+
//Can I delete dir containing a dangling symbolic link, which will cause
`stat` return ENOENT
status = celix_utils_createDirectory(testDir, true, &error);
EXPECT_EQ(status, CELIX_SUCCESS);