]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.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>
Wed, 5 Nov 2025 13:59:34 +0000 (13:59 +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 6a8f8774db21603e426907ee2f53713df496026d..77f71ccb87d9b1f8feabe039c0beb2e4c9d02073 100644 (file)
@@ -61,12 +61,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();
@@ -1564,6 +1570,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);
@@ -1580,6 +1590,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);
@@ -1786,6 +1800,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));