]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/client: add ll_walk test with cwd and root path
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 13 Mar 2025 19:48:15 +0000 (15:48 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Fri, 26 Sep 2025 18:06:05 +0000 (14:06 -0400)
Fixes: https://tracker.ceph.com/issues/70573
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 0306789f7f9fa7a276d3b68a077339b0f1f72ee7)

src/test/client/CMakeLists.txt
src/test/client/ll_api.cc [new file with mode: 0644]

index 9cbfb6309f6b3b3a6166794b32806d1ebbdde3a7..95998d10e65dbe9f246db8a270a92493a0b71fb9 100644 (file)
@@ -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 (file)
index 0000000..24ee936
--- /dev/null
@@ -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 <errno.h>
+
+#include <iostream>
+#include <string>
+
+#include <fmt/format.h>
+
+#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));
+}