diff --git a/frameworks/native/distributed_file_inner/src/copy/file_copy_manager.cpp b/frameworks/native/distributed_file_inner/src/copy/file_copy_manager.cpp index 7e45728b997f492d474a92793a8ac85d2247db75..3e5c7e5a61fbaa7293eeb02c41cd83033ba2e5b4 100644 --- a/frameworks/native/distributed_file_inner/src/copy/file_copy_manager.cpp +++ b/frameworks/native/distributed_file_inner/src/copy/file_copy_manager.cpp @@ -339,7 +339,7 @@ bool FileCopyManager::IsFile(const std::string &path) struct stat buf {}; int ret = stat(path.c_str(), &buf); if (ret == -1) { - LOGI("stat failed, errno is %{public}d, ", errno); + LOGE("stat failed, errno is %{public}d, ", errno); return false; } return (buf.st_mode & S_IFMT) == S_IFREG; diff --git a/frameworks/native/distributed_file_inner/src/copy/remote_file_copy_manager.cpp b/frameworks/native/distributed_file_inner/src/copy/remote_file_copy_manager.cpp index d7f0b93204c1a116323d4000bdfdc5168379d68e..dc041875573f92aaf7c3b54c9e4406d5a53326c3 100644 --- a/frameworks/native/distributed_file_inner/src/copy/remote_file_copy_manager.cpp +++ b/frameworks/native/distributed_file_inner/src/copy/remote_file_copy_manager.cpp @@ -101,7 +101,7 @@ bool RemoteFileCopyManager::IsFile(const std::string &path) struct stat buf {}; int ret = stat(path.c_str(), &buf); if (ret == -1) { - LOGI("stat failed, errno is %{public}d, ", errno); + LOGE("stat failed, errno is %{public}d, ", errno); return false; } return (buf.st_mode & S_IFMT) == S_IFREG; diff --git a/test/unittests/distributed_file_inner/copy/file_copy_manager_test.cpp b/test/unittests/distributed_file_inner/copy/file_copy_manager_test.cpp index 501f247d7642661b0d42eb991749871426ee1714..4cfeae8b330a9e415632f1bfc97078e88e32ac50 100644 --- a/test/unittests/distributed_file_inner/copy/file_copy_manager_test.cpp +++ b/test/unittests/distributed_file_inner/copy/file_copy_manager_test.cpp @@ -181,7 +181,7 @@ HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0004, TestSize.Level0) * @tc.type: FUNC * @tc.require: I7TDJK */ -HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0006, TestSize.Level0) +HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0005, TestSize.Level0) { GTEST_LOG_(INFO) << "FileCopyManager_Copy_0005 Start"; string localUri = "/data/test/test.txt"; @@ -203,14 +203,14 @@ HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0006, TestSize.Level0) } /** - * @tc.name: FileCopyManager_Copy_0007 + * @tc.name: FileCopyManager_Copy_0006 * @tc.desc: The execution of the Copy failed. * @tc.type: FUNC * @tc.require: I7TDJK */ -HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0007, TestSize.Level0) +HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0006, TestSize.Level0) { - GTEST_LOG_(INFO) << "FileCopyManager_Copy_0007 Start"; + GTEST_LOG_(INFO) << "FileCopyManager_Copy_0006 Start"; string srcUri = "file://docs/storage/media/100/local/files/Docs/1.txt"; string destUri = "file://docs/storage/media/100/local/files/Docs/a1.txt"; string srcPath = "/storage/media/100/local/files/Docs/1.txt"; @@ -222,7 +222,7 @@ HWTEST_F(FileCopyManagerTest, FileCopyManager_Copy_0007, TestSize.Level0) ret = Storage::DistributedFile::FileCopyManager::GetInstance()->Copy(srcUri, destUri, listener_); EXPECT_EQ(ret, ENOENT); - GTEST_LOG_(INFO) << "FileCopyManager_Copy_0007 End"; + GTEST_LOG_(INFO) << "FileCopyManager_Copy_0006 End"; } /** @@ -364,7 +364,7 @@ HWTEST_F(FileCopyManagerTest, FileCopyManager_ExecLocal_0003, TestSize.Level0) infos->srcUriIsFile, processCallback); // srcUriIsFile is true, destpath not exist auto ret = Storage::DistributedFile::FileCopyManager::GetInstance()->ExecLocal(infos); - EXPECT_EQ(ret, ENOTDIR); + EXPECT_NE(ret, E_OK); ASSERT_EQ(remove(srcpath.c_str()), 0); ASSERT_EQ(remove(destpath.c_str()), 0); GTEST_LOG_(INFO) << "FileCopyManager_ExecLocal_0003 End"; @@ -1003,6 +1003,7 @@ HWTEST_F(FileCopyManagerTest, FileCopyManager_Cancel_0004, TestSize.Level0) destUri = "destUri1"; ret = Storage::DistributedFile::FileCopyManager::GetInstance()->Cancel(srcUri, destUri); EXPECT_EQ(ret, E_OK); + Storage::DistributedFile::FileCopyManager::GetInstance()->FileInfosVec_.clear(); GTEST_LOG_(INFO) << "FileCopyManager_Cancel_0004 End"; }