From 8862e60e6bacbf21906a6340a39ce69cb1a3e749 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 13 Mar 2025 15:48:15 -0400 Subject: [PATCH] test/client: add ll_walk test with cwd and root path Fixes: https://tracker.ceph.com/issues/70573 Signed-off-by: Patrick Donnelly (cherry picked from commit 0306789f7f9fa7a276d3b68a077339b0f1f72ee7) --- src/test/client/CMakeLists.txt | 1 + src/test/client/ll_api.cc | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/test/client/ll_api.cc diff --git a/src/test/client/CMakeLists.txt b/src/test/client/CMakeLists.txt index 9cbfb6309f6..95998d10e65 100644 --- a/src/test/client/CMakeLists.txt +++ b/src/test/client/CMakeLists.txt @@ -2,6 +2,7 @@ if(${WITH_CEPHFS}) add_executable(ceph_test_client main.cc alternate_name.cc + ll_api.cc ops.cc commands.cc syncio.cc diff --git a/src/test/client/ll_api.cc b/src/test/client/ll_api.cc new file mode 100644 index 00000000000..24ee9362ea8 --- /dev/null +++ b/src/test/client/ll_api.cc @@ -0,0 +1,39 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2025 IBM, Inc. + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + +#include + +#include +#include + +#include + +#include "test/client/TestClient.h" + +TEST_F(TestClient, LL_Walk) { + auto dir = fmt::format("/{}_{}", ::testing::UnitTest::GetInstance()->current_test_info()->name(), getpid()); + ASSERT_EQ(0, client->mkdir(dir.c_str(), 0777, myperm)); + + std::string newcwd; + ASSERT_EQ(0, client->chdir(dir.c_str(), newcwd, myperm)); + std::string cwd; + client->getcwd(cwd, myperm); + ASSERT_STREQ(cwd.c_str(), dir.c_str()); + + Inode* in = nullptr; + struct ceph_statx xbuf; + ASSERT_EQ(0, client->ll_walk(dir.c_str(), &in, &xbuf, 0, 0, myperm)); + + ASSERT_EQ(0, client->rmdir(dir.c_str(), myperm)); +} -- 2.39.5