]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/libcephfs: Add skips to tests where mount root is a subdir
authorChristopher Hoffman <choffman@redhat.com>
Fri, 31 Jan 2025 18:53:14 +0000 (18:53 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 14 Aug 2025 20:09:47 +0000 (20:09 +0000)
When dir_prefix is a subdir, skip tests that expect
behavior of "/" to be on root of filesystem.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/test/libcephfs/fscrypt.cc
src/test/libcephfs/test.cc
src/test/libcephfs/test.h

index f3f463dce7ca7575ad73664151daf09107199fac..b9aa2935db99fb70a3a53380ead39a5d51d39048 100644 (file)
@@ -239,6 +239,7 @@ static int init_fscrypt()
   }
 
   libcephfs_test_set_mount_call(do_fscrypt_mount);
+  libcephfs_test_set_dir_prefix(fscrypt_dir);
   std::clog << __func__ << "(): init fscrypt done" << std::endl;
 
   return 0;
index a8d1b21bfe9993f95d742ebb851553e2e21891c8..5adb1ad28a90e5a1c51071e9b135e5fe29a95b52 100644 (file)
@@ -60,12 +60,18 @@ static std::string generate_random_string(int length = 20) {
 }
 
 static int (*do_ceph_mount)(struct ceph_mount_info *cmount, const char *root) = ceph_mount;
+static std::string dir_prefix = std::string("/");
 
 void libcephfs_test_set_mount_call(int (*mount_call)(struct ceph_mount_info *cmount, const char *root))
 {
   do_ceph_mount = mount_call;
 }
 
+void libcephfs_test_set_dir_prefix(std::string (prefix))
+{
+  dir_prefix = prefix;
+}
+
 TEST(LibCephFS, OpenEmptyComponent) {
 
   pid_t mypid = getpid();
@@ -1511,6 +1517,10 @@ TEST(LibCephFS, UseUnmounted) {
 }
 
 TEST(LibCephFS, GetPoolId) {
+  if (dir_prefix != "/") {
+    GTEST_SKIP() << "Layout is only available on dir after explicit customization";
+  }
+
   struct ceph_mount_info *cmount;
   ASSERT_EQ(ceph_create(&cmount, NULL), 0);
   ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
@@ -1527,6 +1537,10 @@ TEST(LibCephFS, GetPoolId) {
 }
 
 TEST(LibCephFS, GetPoolReplication) {
+  if (dir_prefix != "/") {
+    GTEST_SKIP() << "Layout is only available on dir after explicit customization";
+  }
+
   struct ceph_mount_info *cmount;
   ASSERT_EQ(ceph_create(&cmount, NULL), 0);
   ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
@@ -1733,6 +1747,10 @@ TEST(LibCephFS, Nlink) {
 }
 
 TEST(LibCephFS, SlashDotDot) {
+  if (dir_prefix != "/") {
+    GTEST_SKIP() << "We aren't at root, skipping test";
+  }
+
   struct ceph_mount_info *cmount;
   ASSERT_EQ(ceph_create(&cmount, NULL), 0);
   ASSERT_EQ(ceph_conf_read_file(cmount, NULL), 0);
index eb5894f87abc95d9d7a2e14b3e920ef8e7e18052..953b65c70444acbb1772b699902c4f39866ca9a8 100644 (file)
@@ -4,3 +4,4 @@
 struct ceph_mount_info;
 
 void libcephfs_test_set_mount_call(int (*mount_call)(struct ceph_mount_info *cmount, const char *root));
+void libcephfs_test_set_dir_prefix(std::string (prefix));