• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gmock/gmock.h>
17 #include <gtest/gtest.h>
18 
19 #include "assistant.h"
20 #include "cloud_disk_inode.h"
21 #include "dfs_error.h"
22 #include "file_operations_base.h"
23 #include "file_operations_helper.h"
24 
25 namespace OHOS::FileManagement::CloudDisk::Test {
26 using namespace testing;
27 using namespace testing::ext;
28 
29 class FileOperationBaseTest : public testing::Test {
30 public:
31     static void SetUpTestCase(void);
32     static void TearDownTestCase(void);
33     void SetUp();
34     void TearDown();
35     static inline FileOperationsBase* fileoperationBase_ = new FileOperationsBase();
36     static inline std::shared_ptr<AssistantMock> insMock = nullptr;
37 };
38 
SetUpTestCase(void)39 void FileOperationBaseTest::SetUpTestCase(void)
40 {
41     GTEST_LOG_(INFO) << "SetUpTestCase";
42 }
43 
TearDownTestCase(void)44 void FileOperationBaseTest::TearDownTestCase(void)
45 {
46     fileoperationBase_ = nullptr;
47     GTEST_LOG_(INFO) << "TearDownTestCase";
48 }
49 
SetUp(void)50 void FileOperationBaseTest::SetUp(void)
51 {
52     GTEST_LOG_(INFO) << "SetUp";
53     insMock = std::make_shared<AssistantMock>();
54     Assistant::ins = insMock;
55 }
56 
TearDown(void)57 void FileOperationBaseTest::TearDown(void)
58 {
59     GTEST_LOG_(INFO) << "TearDown";
60     Assistant::ins = nullptr;
61     insMock = nullptr;
62 }
63 
64 /**
65  * @tc.name: ForgetTest001
66  * @tc.desc: Verify the Forget function
67  * @tc.type: FUNC
68  * @tc.require: issuesI92WQP
69  */
70 HWTEST_F(FileOperationBaseTest, ForgetTest001, TestSize.Level1)
71 {
72     GTEST_LOG_(INFO) << "ForgetTest001 Start";
73     try {
74         CloudDiskFuseData data;
75         EXPECT_CALL(*insMock, fuse_req_userdata(_)).WillOnce(Return(reinterpret_cast<void*>(&data)));
76         fuse_req_t req = nullptr;
77         uint64_t nLookup = 0;
78 
79         fileoperationBase_->Forget(req, FUSE_ROOT_ID, nLookup);
80         EXPECT_TRUE(true);
81     } catch (...) {
82         EXPECT_TRUE(false);
83         GTEST_LOG_(INFO) << "ForgetTest001  ERROR";
84     }
85     GTEST_LOG_(INFO) << "ForgetTest001 End";
86 }
87 
88 /**
89  * @tc.name: ForgetTest002
90  * @tc.desc: Verify the Forget function
91  * @tc.type: FUNC
92  * @tc.require: issuesI92WQP
93  */
94 HWTEST_F(FileOperationBaseTest, ForgetTest002, TestSize.Level1)
95 {
96     GTEST_LOG_(INFO) << "ForgetTest002 Start";
97     try {
98         CloudDiskFuseData data;
99         EXPECT_CALL(*insMock, fuse_req_userdata(_)).WillOnce(Return(reinterpret_cast<void*>(&data)));
100         fuse_req_t req = nullptr;
101         uint64_t nLookup = 0;
102 
103         fileoperationBase_->Forget(req, 0, nLookup);
104         EXPECT_TRUE(true);
105     } catch (...) {
106         EXPECT_TRUE(false);
107         GTEST_LOG_(INFO) << "ForgetTest002  ERROR";
108     }
109     GTEST_LOG_(INFO) << "ForgetTest002 End";
110 }
111 
112 /**
113  * @tc.name: ForgetMultiTest001
114  * @tc.desc: Verify the ForgetMulti function
115  * @tc.type: FUNC
116  * @tc.require: issuesI92WQP
117  */
118 HWTEST_F(FileOperationBaseTest, ForgetMultiTest001, TestSize.Level1)
119 {
120     GTEST_LOG_(INFO) << "ForgetMultiTest001 Start";
121     try {
122         CloudDiskFuseData data;
123         EXPECT_CALL(*insMock, fuse_req_userdata(_)).WillOnce(Return(reinterpret_cast<void*>(&data)));
124         fuse_req_t req = nullptr;
125         fuse_forget_data* forgets = nullptr;
126 
127         fileoperationBase_->ForgetMulti(req, 0, forgets);
128         EXPECT_TRUE(true);
129     } catch (...) {
130         EXPECT_TRUE(false);
131         GTEST_LOG_(INFO) << "ForgetMultiTest001  ERROR";
132     }
133     GTEST_LOG_(INFO) << "ForgetMultiTest001 End";
134 }
135 
136 /**
137  * @tc.name: ForgetMultiTest002
138  * @tc.desc: Verify the ForgetMulti function
139  * @tc.type: FUNC
140  * @tc.require: issuesI92WQP
141  */
142 HWTEST_F(FileOperationBaseTest, ForgetMultiTest002, TestSize.Level1)
143 {
144     GTEST_LOG_(INFO) << "ForgetMultiTest002 Start";
145     try {
146         CloudDiskFuseData data;
147         EXPECT_CALL(*insMock, fuse_req_userdata(_)).WillOnce(Return(reinterpret_cast<void*>(&data)));
148         fuse_req_t req = nullptr;
149         struct fuse_forget_data forgets;
150         forgets.ino = 2;
151 
152         fileoperationBase_->ForgetMulti(req, 1, &forgets);
153         EXPECT_TRUE(true);
154     } catch (...) {
155         EXPECT_TRUE(false);
156         GTEST_LOG_(INFO) << "ForgetMultiTest002  ERROR";
157     }
158     GTEST_LOG_(INFO) << "ForgetMultiTest002 End";
159 }
160 
161 /**
162  * @tc.name: ForgetMultiTest003
163  * @tc.desc: Verify the ForgetMulti function
164  * @tc.type: FUNC
165  * @tc.require: issuesI92WQP
166  */
167 HWTEST_F(FileOperationBaseTest, ForgetMultiTest003, TestSize.Level1)
168 {
169     GTEST_LOG_(INFO) << "ForgetMultiTest003 Start";
170     try {
171         CloudDiskFuseData data;
172         (data.inodeCache)[2] = std::make_shared<CloudDiskInode>();
173         EXPECT_CALL(*insMock, fuse_req_userdata(_)).WillOnce(Return(reinterpret_cast<void*>(&data)));
174         fuse_req_t req = nullptr;
175         struct fuse_forget_data forgets;
176         forgets.ino = 2;
177 
178         fileoperationBase_->ForgetMulti(req, 1, &forgets);
179         EXPECT_TRUE(true);
180     } catch (...) {
181         EXPECT_TRUE(false);
182         GTEST_LOG_(INFO) << "ForgetMultiTest003  ERROR";
183     }
184     GTEST_LOG_(INFO) << "ForgetMultiTest003 End";
185 }
186 
187 /**
188  * @tc.name: ForgetTest003
189  * @tc.desc: Verify the Forget function
190  * @tc.type: FUNC
191  * @tc.require: issuesI92WQP
192  */
193 HWTEST_F(FileOperationBaseTest, ForgetTest003, TestSize.Level1)
194 {
195     GTEST_LOG_(INFO) << "ForgetTest003 Start";
196     try {
197         CloudDiskFuseData data;
198         (data.inodeCache)[1] = std::make_shared<CloudDiskInode>();
199         EXPECT_CALL(*insMock, fuse_req_userdata(_)).WillOnce(Return(reinterpret_cast<void*>(&data)));
200         fuse_req_t req = nullptr;
201         uint64_t nLookup = 1;
202 
203         fileoperationBase_->Forget(req, 1, nLookup);
204         EXPECT_TRUE(true);
205     } catch (...) {
206         EXPECT_TRUE(false);
207         GTEST_LOG_(INFO) << "ForgetTest003  ERROR";
208     }
209 }
210 
211 /**
212  * @tc.name: LookupTest001
213  * @tc.desc: Verify the Lookup function
214  * @tc.type: FUNC
215  * @tc.require: issuesIB4SSZ
216  */
217 HWTEST_F(FileOperationBaseTest, LookupTest001, TestSize.Level1)
218 {
219     GTEST_LOG_(INFO) << "LookupTest001 start";
220     try {
221         fuse_req_t req = nullptr;
222         fuse_ino_t parent = FUSE_ROOT_ID;
223         const char *name = "testFile";
224         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
225         fileoperationBase_->Lookup(req, parent, name);
226         EXPECT_TRUE(true);
227     } catch (...) {
228         EXPECT_TRUE(false);
229         GTEST_LOG_(INFO) << "LookupTest001 failed";
230     }
231     GTEST_LOG_(INFO) << "LookupTest001 end";
232 }
233 
234 /**
235  * @tc.name: AccessTest001
236  * @tc.desc: Verify the Access function
237  * @tc.type: FUNC
238  * @tc.require: issuesIB4SSZ
239  */
240 HWTEST_F(FileOperationBaseTest, AccessTest001, TestSize.Level1)
241 {
242     GTEST_LOG_(INFO) << "AccessTest001 start";
243     try {
244         fuse_ino_t ino = FUSE_ROOT_ID;
245         fuse_req_t req = nullptr;
246         int mask = 0;
247         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
248         fileoperationBase_->Access(req, ino, mask);
249         EXPECT_TRUE(true);
250     } catch (...) {
251         EXPECT_TRUE(false);
252         GTEST_LOG_(INFO) << "AccessTest001 failed";
253     }
254     GTEST_LOG_(INFO) << "AccessTest001 end";
255 }
256 
257 /**
258  * @tc.name: GetAttrTest001
259  * @tc.desc: Verify the GetAttr function
260  * @tc.type: FUNC
261  * @tc.require: issuesIB4SSZ
262  */
263 HWTEST_F(FileOperationBaseTest, GetAttrTest001, TestSize.Level1)
264 {
265     GTEST_LOG_(INFO) << "GetAttrTest001 start";
266     try {
267         fuse_req_t req = nullptr;
268         fuse_ino_t ino = FUSE_ROOT_ID;
269         auto fi = std::make_shared<fuse_file_info>();
270         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
271         fileoperationBase_->GetAttr(req, ino, fi.get());
272         EXPECT_TRUE(true);
273     } catch (...) {
274         EXPECT_TRUE(false);
275         GTEST_LOG_(INFO) << "GetAttrTest001 failed";
276     }
277     GTEST_LOG_(INFO) << "GetAttrTest001 end";
278 }
279 
280 /**
281  * @tc.name: OpenTest001
282  * @tc.desc: Verify the Open function
283  * @tc.type: FUNC
284  * @tc.require: issuesIB4SSZ
285  */
286 HWTEST_F(FileOperationBaseTest, OpenTest001, TestSize.Level1)
287 {
288     GTEST_LOG_(INFO) << "OpenTest001 start";
289     try {
290         fuse_req_t req = nullptr;
291         fuse_ino_t ino = FUSE_ROOT_ID;
292         auto fi = std::make_shared<fuse_file_info>();
293         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
294         fileoperationBase_->Open(req, ino, fi.get());
295         EXPECT_TRUE(true);
296     } catch (...) {
297         EXPECT_TRUE(false);
298         GTEST_LOG_(INFO) << "OpenTest001 failed";
299     }
300     GTEST_LOG_(INFO) << "OpenTest001 end";
301 }
302 
303 /**
304  * @tc.name: MkDirTest001
305  * @tc.desc: Verify the MkDir function
306  * @tc.type: FUNC
307  * @tc.require: issuesIB4SSZ
308  */
309 HWTEST_F(FileOperationBaseTest, MkDirTest001, TestSize.Level1)
310 {
311     GTEST_LOG_(INFO) << "MkDirTest001 start";
312     try {
313         fuse_req_t req = nullptr;
314         fuse_ino_t parent = FUSE_ROOT_ID;
315         const char *name = "testMkdir";
316         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
317         fileoperationBase_->MkDir(req, parent, name, 0);
318         EXPECT_TRUE(true);
319     } catch (...) {
320         EXPECT_TRUE(false);
321         GTEST_LOG_(INFO) << "MkDirTest001 failed";
322     }
323     GTEST_LOG_(INFO) << "MkDirTest001 end";
324 }
325 
326 /**
327  * @tc.name: RmDirTest001
328  * @tc.desc: Verify the RmDir function
329  * @tc.type: FUNC
330  * @tc.require: issuesIB4SSZ
331  */
332 HWTEST_F(FileOperationBaseTest, RmDirTest001, TestSize.Level1)
333 {
334     GTEST_LOG_(INFO) << "RmDirTest001 start";
335     try {
336         fuse_req_t req = nullptr;
337         fuse_ino_t parent = FUSE_ROOT_ID;
338         const char *name = "testRmDir";
339         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
340         fileoperationBase_->RmDir(req, parent, name);
341         EXPECT_TRUE(true);
342     } catch (...) {
343         EXPECT_TRUE(false);
344         GTEST_LOG_(INFO) << "RmDirTest001 failed";
345     }
346     GTEST_LOG_(INFO) << "RmDirTest001 end";
347 }
348 
349 /**
350  * @tc.name: UnlinkTest001
351  * @tc.desc: Verify the Unlink function
352  * @tc.type: FUNC
353  * @tc.require: issuesIB4SSZ
354  */
355 HWTEST_F(FileOperationBaseTest, UnlinkTest001, TestSize.Level1)
356 {
357     GTEST_LOG_(INFO) << "UnlinkTest001 start";
358     try {
359         fuse_req_t req = nullptr;
360         fuse_ino_t parent = FUSE_ROOT_ID;
361         const char *name = "testUnlink";
362         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
363         fileoperationBase_->Unlink(req, parent, name);
364         EXPECT_TRUE(true);
365     } catch (...) {
366         EXPECT_TRUE(false);
367         GTEST_LOG_(INFO) << "UnlinkTest001 failed";
368     }
369     GTEST_LOG_(INFO) << "UnlinkTest001 end";
370 }
371 
372 /**
373  * @tc.name: ReleaseTest001
374  * @tc.desc: Verify the Release function
375  * @tc.type: FUNC
376  * @tc.require: issuesIB4SSZ
377  */
378 HWTEST_F(FileOperationBaseTest, ReleaseTest001, TestSize.Level1)
379 {
380     GTEST_LOG_(INFO) << "ReleaseTest001 start";
381     try {
382         fuse_req_t req = nullptr;
383         fuse_ino_t parent = FUSE_ROOT_ID;
384         auto fi = std::make_shared<fuse_file_info>();
385         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
386         fileoperationBase_->Release(req, parent, fi.get());
387         EXPECT_TRUE(true);
388     } catch (...) {
389         EXPECT_TRUE(false);
390         GTEST_LOG_(INFO) << "ReleaseTest001 failed";
391     }
392     GTEST_LOG_(INFO) << "ReleaseTest001 end";
393 }
394 
395 /**
396  * @tc.name: MkNodTest001
397  * @tc.desc: Verify the MkNod function
398  * @tc.type: FUNC
399  * @tc.require: issuesIB4SSZ
400  */
401 HWTEST_F(FileOperationBaseTest, MkNodTest001, TestSize.Level1)
402 {
403     GTEST_LOG_(INFO) << "MkNodTest001 start";
404     try {
405         fuse_req_t req = nullptr;
406         fuse_ino_t parent = FUSE_ROOT_ID;
407         const char *name = "testMkmod";
408         mode_t mode = 0;
409         dev_t rdev = 0;
410         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
411         fileoperationBase_->MkNod(req, parent, name, mode, rdev);
412         EXPECT_TRUE(true);
413     } catch (...) {
414         EXPECT_TRUE(false);
415         GTEST_LOG_(INFO) << "MkNodTest001 failed";
416     }
417     GTEST_LOG_(INFO) << "MkNodTest001 end";
418 }
419 
420 /**
421  * @tc.name: CreateTest001
422  * @tc.desc: Verify the Create function
423  * @tc.type: FUNC
424  * @tc.require: issuesIB4SSZ
425  */
426 HWTEST_F(FileOperationBaseTest, CreateTest001, TestSize.Level1)
427 {
428     GTEST_LOG_(INFO) << "CreateTest001 start";
429     try {
430         fuse_req_t req = nullptr;
431         fuse_ino_t parent = FUSE_ROOT_ID;
432         const char *name = "testMkmod";
433         mode_t mode = 0;
434         auto fi = std::make_shared<fuse_file_info>();
435         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
436         fileoperationBase_->Create(req, parent, name, mode, fi.get());
437         EXPECT_TRUE(true);
438     } catch (...) {
439         EXPECT_TRUE(false);
440         GTEST_LOG_(INFO) << "MkNodTest001 failed";
441     }
442     GTEST_LOG_(INFO) << "MkNodTest001 end";
443 }
444 
445 /**
446  * @tc.name: ReadDirTest001
447  * @tc.desc: Verify the ReadDir function
448  * @tc.type: FUNC
449  * @tc.require: issuesIB4SSZ
450  */
451 HWTEST_F(FileOperationBaseTest, ReadDirTest001, TestSize.Level1)
452 {
453     GTEST_LOG_(INFO) << "ReadDirTest001 start";
454     try {
455         fuse_req_t req = nullptr;
456         fuse_ino_t ino = FUSE_ROOT_ID;
457         size_t size = 0;
458         off_t off = 0;
459         auto fi = std::make_shared<fuse_file_info>();
460         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
461         fileoperationBase_->ReadDir(req, ino, size, off, fi.get());
462         EXPECT_TRUE(true);
463     } catch (...) {
464         EXPECT_TRUE(false);
465         GTEST_LOG_(INFO) << "ReadDirTest001 failed";
466     }
467     GTEST_LOG_(INFO) << "ReadDirTest001 end";
468 }
469 
470 /**
471  * @tc.name: SetXattrTest001
472  * @tc.desc: Verify the SetXattr function
473  * @tc.type: FUNC
474  * @tc.require: issuesIB4SSZ
475  */
476 HWTEST_F(FileOperationBaseTest, SetXattrTest001, TestSize.Level1)
477 {
478     GTEST_LOG_(INFO) << "SetXattrTest001 start";
479     try {
480         fuse_req_t req = nullptr;
481         fuse_ino_t ino = FUSE_ROOT_ID;
482         const char *name = "testSetXattr";
483         const char *value = "";
484         size_t size = 0;
485         int flags = 0;
486         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
487         fileoperationBase_->SetXattr(req, ino, name, value, size, flags);
488         EXPECT_TRUE(true);
489     } catch (...) {
490         EXPECT_TRUE(false);
491         GTEST_LOG_(INFO) << "SetXattrTest001 failed";
492     }
493     GTEST_LOG_(INFO) << "SetXattrTest001 end";
494 }
495 
496 /**
497  * @tc.name: GetXattrTest001
498  * @tc.desc: Verify the GetXattr function
499  * @tc.type: FUNC
500  * @tc.require: issuesIB4SSZ
501  */
502 HWTEST_F(FileOperationBaseTest, GetXattrTest001, TestSize.Level1)
503 {
504     GTEST_LOG_(INFO) << "GetXattrTest001 start";
505     try {
506         fuse_req_t req = nullptr;
507         fuse_ino_t ino = FUSE_ROOT_ID;
508         const char *name = "testGetXattr";
509         size_t size = 0;
510         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
511         fileoperationBase_->GetXattr(req, ino, name, size);
512         EXPECT_TRUE(true);
513     } catch (...) {
514         EXPECT_TRUE(false);
515         GTEST_LOG_(INFO) << "GetXattrTest001 failed";
516     }
517     GTEST_LOG_(INFO) << "GetXattrTest001 end";
518 }
519 
520 /**
521  * @tc.name: RenameTest001
522  * @tc.desc: Verify the Rename function
523  * @tc.type: FUNC
524  * @tc.require: issuesIB4SSZ
525  */
526 HWTEST_F(FileOperationBaseTest, RenameTest001, TestSize.Level1)
527 {
528     GTEST_LOG_(INFO) << "RenameTest001 start";
529     try {
530         fuse_req_t req = nullptr;
531         fuse_ino_t parent = 0;
532         const char *name = "testRename";
533         fuse_ino_t newParent = FUSE_ROOT_ID;
534         const char *newName = "renameTest";
535         unsigned int flags = 0;
536         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
537         fileoperationBase_->Rename(req, parent, name, newParent, newName, flags);
538         EXPECT_TRUE(true);
539     } catch (...) {
540         EXPECT_TRUE(false);
541         GTEST_LOG_(INFO) << "RenameTest001 failed";
542     }
543     GTEST_LOG_(INFO) << "RenameTest001 end";
544 }
545 
546 /**
547  * @tc.name: ReadTest001
548  * @tc.desc: Verify the Read function
549  * @tc.type: FUNC
550  * @tc.require: issuesIB4SSZ
551  */
552 HWTEST_F(FileOperationBaseTest, ReadTest001, TestSize.Level1)
553 {
554     GTEST_LOG_(INFO) << "ReadTest001 start";
555     try {
556         fuse_req_t req = nullptr;
557         fuse_ino_t ino = FUSE_ROOT_ID;
558         size_t size = 0;
559         off_t offset = 0;
560         auto fi = std::make_shared<fuse_file_info>();
561         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
562         fileoperationBase_->Read(req, ino, size, offset, fi.get());
563         EXPECT_TRUE(true);
564     } catch (...) {
565         EXPECT_TRUE(false);
566         GTEST_LOG_(INFO) << "ReadTest001 failed";
567     }
568     GTEST_LOG_(INFO) << "ReadTest001 end";
569 }
570 
571 /**
572  * @tc.name: WriteBufTest001
573  * @tc.desc: Verify the WriteBuf function
574  * @tc.type: FUNC
575  * @tc.require: issuesIB4SSZ
576  */
577 HWTEST_F(FileOperationBaseTest, WriteBufTest001, TestSize.Level1)
578 {
579     GTEST_LOG_(INFO) << "WriteBufTest001 start";
580     try {
581         fuse_req_t req = nullptr;
582         fuse_ino_t ino = FUSE_ROOT_ID;
583         std::shared_ptr<fuse_bufvec> buf = std::make_shared<fuse_bufvec>();
584         off_t offset = 0;
585         auto fi = std::make_shared<fuse_file_info>();
586         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
587         fileoperationBase_->WriteBuf(req, ino, buf.get(), offset, fi.get());
588         EXPECT_TRUE(true);
589     } catch (...) {
590         EXPECT_TRUE(false);
591         GTEST_LOG_(INFO) << "WriteBufTest001 failed";
592     }
593     GTEST_LOG_(INFO) << "WriteBufTest001 end";
594 }
595 
596 /**
597  * @tc.name: SetAttrTest001
598  * @tc.desc: Verify the SetAttr function
599  * @tc.type: FUNC
600  * @tc.require: issuesIB4SSZ
601  */
602 HWTEST_F(FileOperationBaseTest, SetAttrTest001, TestSize.Level1)
603 {
604     GTEST_LOG_(INFO) << "SetAttrTest001 start";
605     try {
606         fuse_req_t req = nullptr;
607         fuse_ino_t ino = FUSE_ROOT_ID;
608         std::shared_ptr<struct stat> attr = std::make_shared<struct stat>();
609         int valid = 0;
610         auto fi = std::make_shared<fuse_file_info>();
611         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
612         fileoperationBase_->SetAttr(req, ino, attr.get(), valid, fi.get());
613         EXPECT_TRUE(true);
614     } catch (...) {
615         EXPECT_TRUE(false);
616         GTEST_LOG_(INFO) << "SetAttrTest001 failed";
617     }
618     GTEST_LOG_(INFO) << "SetAttrTest001 end";
619 }
620 
621 /**
622  * @tc.name: LseekTest001
623  * @tc.desc: Verify the Lseek function
624  * @tc.type: FUNC
625  * @tc.require: issuesIB4SSZ
626  */
627 HWTEST_F(FileOperationBaseTest, LseekTest001, TestSize.Level1)
628 {
629     GTEST_LOG_(INFO) << "LseekTest001 start";
630     try {
631         fuse_req_t req = nullptr;
632         fuse_ino_t ino = FUSE_ROOT_ID;
633         off_t offset = 0;
634         int whence = 0;
635         auto fi = std::make_shared<fuse_file_info>();
636         EXPECT_CALL(*insMock, fuse_reply_err(_, _)).Times(1);
637         fileoperationBase_->Lseek(req, ino, offset, whence, fi.get());
638         EXPECT_TRUE(true);
639     } catch (...) {
640         EXPECT_TRUE(false);
641         GTEST_LOG_(INFO) << "LseekTest001 failed";
642     }
643     GTEST_LOG_(INFO) << "LseekTest001 end";
644 }
645 } // namespace OHOS::FileManagement::CloudDisk::Test