From: Christopher Hoffman Date: Fri, 31 Jan 2025 18:53:14 +0000 (+0000) Subject: test/libcephfs: Add skips to tests where mount root is a subdir X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=18e41525cc2b32ad325fffd820c97cdd0f901f38;p=ceph-ci.git test/libcephfs: Add skips to tests where mount root is a subdir When dir_prefix is a subdir, skip tests that expect behavior of "/" to be on root of filesystem. Signed-off-by: Christopher Hoffman --- diff --git a/src/test/libcephfs/fscrypt.cc b/src/test/libcephfs/fscrypt.cc index f3f463dce7c..b9aa2935db9 100644 --- a/src/test/libcephfs/fscrypt.cc +++ b/src/test/libcephfs/fscrypt.cc @@ -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; diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index a8d1b21bfe9..5adb1ad28a9 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -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); diff --git a/src/test/libcephfs/test.h b/src/test/libcephfs/test.h index eb5894f87ab..953b65c7044 100644 --- a/src/test/libcephfs/test.h +++ b/src/test/libcephfs/test.h @@ -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));