Skip to content

Commit 0306789

Browse files
committed
test/client: add ll_walk test with cwd and root path
Fixes: https://tracker.ceph.com/issues/70573 Signed-off-by: Patrick Donnelly <[email protected]>
1 parent 0c6ab96 commit 0306789

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/test/client/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ if(${WITH_CEPHFS})
22
add_executable(ceph_test_client
33
main.cc
44
alternate_name.cc
5+
ll_api.cc
56
ops.cc
67
nonblocking.cc
78
commands.cc

src/test/client/ll_api.cc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2+
// vim: ts=8 sw=2 smarttab
3+
/*
4+
* Ceph - scalable distributed file system
5+
*
6+
* Copyright (C) 2025 IBM, Inc.
7+
*
8+
* This is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License version 2.1, as published by the Free Software
11+
* Foundation. See file COPYING.
12+
*
13+
*/
14+
15+
#include <errno.h>
16+
17+
#include <iostream>
18+
#include <string>
19+
20+
#include <fmt/format.h>
21+
22+
#include "test/client/TestClient.h"
23+
24+
TEST_F(TestClient, LL_Walk) {
25+
auto dir = fmt::format("/{}_{}", ::testing::UnitTest::GetInstance()->current_test_info()->name(), getpid());
26+
ASSERT_EQ(0, client->mkdir(dir.c_str(), 0777, myperm));
27+
28+
ASSERT_EQ(0, client->chdir(dir.c_str(), myperm));
29+
std::string cwd;
30+
ASSERT_EQ(0, client->getcwd(cwd, myperm));
31+
ASSERT_STREQ(cwd.c_str(), dir.c_str());
32+
33+
Inode* in = nullptr;
34+
struct ceph_statx xbuf;
35+
ASSERT_EQ(0, client->ll_walk(dir.c_str(), &in, &xbuf, 0, 0, myperm));
36+
37+
ASSERT_EQ(0, client->rmdir(dir.c_str(), myperm));
38+
}

0 commit comments

Comments
 (0)