区分sd卡 u盘接口更改

Signed-off-by: s30051537 <sunxiaoqiang7@huawei.com>
This commit is contained in:
s30051537 2024-10-23 11:49:17 +08:00
parent 807853c1f3
commit 8333e1b4c5
4 changed files with 17 additions and 6 deletions

View File

@ -296,21 +296,21 @@ HWTEST_F(ExternalVolumeInfoTest, Storage_Service_ExternalVolumeInfoTest_GetFsUui
}
/**
* @tc.name: Storage_Service_ExternalVolumeInfoTest_GetFsLabel_001
* @tc.desc: Verify the GetFsLabel function.
* @tc.name: Storage_Service_ExternalVolumeInfoTest_GetFlags_001
* @tc.desc: Verify the GetFlags function.
* @tc.type: FUNC
* @tc.require: AR000H09L6
*/
HWTEST_F(ExternalVolumeInfoTest, Storage_Service_ExternalVolumeInfoTest_GetFsLabel_001, TestSize.Level1)
HWTEST_F(ExternalVolumeInfoTest, Storage_Service_ExternalVolumeInfoTest_GetFlags_001, TestSize.Level1)
{
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetFsLabel_001 start";
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetFlags_001 start";
ASSERT_TRUE(externalVolumeInfo_ != nullptr);
std::string ret = externalVolumeInfo_->GetFsLabel();
std::string ret = externalVolumeInfo_->GetFlags();
GTEST_LOG_(INFO) << ret;
EXPECT_TRUE(ret.empty());
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetFsLabel_001 end";
GTEST_LOG_(INFO) << "Storage_Service_ExternalVolumeInfoTest_GetFlags_001 end";
}
/**

View File

@ -92,6 +92,10 @@ bool VolumeExternal::Marshalling(Parcel &parcel) const
return false;
}
if (!parcel.WriteInt32(flags_)) {
return false;
}
if (!parcel.WriteInt32(fsType_)) {
return false;
}
@ -114,6 +118,7 @@ bool VolumeExternal::Marshalling(Parcel &parcel) const
std::unique_ptr<VolumeExternal> VolumeExternal::Unmarshalling(Parcel &parcel)
{
auto obj = std::make_unique<VolumeExternal>(*VolumeCore::Unmarshalling(parcel));
obj->flags_ = parcel.ReadInt32();
obj->fsType_ = parcel.ReadInt32();
obj->fsUuid_ = parcel.ReadString();
obj->path_ = parcel.ReadString();

View File

@ -42,6 +42,7 @@ public:
HWTEST_F(VolumeExternalTest, Volume_external_Get_0000, testing::ext::TestSize.Level1)
{
GTEST_LOG_(INFO) << "VolumeExternalTest-begin Volume_external_Get_0000";
int32_t flags = 1;
int32_t fsType = 1;
std::string fsUuid = "100";
std::string path = "/";
@ -51,6 +52,7 @@ HWTEST_F(VolumeExternalTest, Volume_external_Get_0000, testing::ext::TestSize.Le
volumeexternal.SetFsUuid(fsUuid);
volumeexternal.SetPath(path);
volumeexternal.SetDescription(description);
volumeexternal.SetFlags(flags);
auto result1 = volumeexternal.GetFsType();
EXPECT_EQ(result1, fsType);
auto result2 = volumeexternal.GetUuid();
@ -66,6 +68,8 @@ HWTEST_F(VolumeExternalTest, Volume_external_Get_0000, testing::ext::TestSize.Le
volumeexternal.SetFsType(FsType::UNDEFINED);
auto result6 = volumeexternal.GetFsTypeString();
EXPECT_EQ(result6, "undefined");
auto result7 = volumeexternal.GetFlags();
EXPECT_EQ(result7, flags);
volumeexternal.Reset();
GTEST_LOG_(INFO) << "VolumeExternalTest-end Volume_external_Get_0000";
}

View File

@ -27,10 +27,12 @@ bool FileUtilFuzzTest(const uint8_t *data, size_t size)
StorageManager::VolumeExternal volumeexternal;
int32_t fsType = *(reinterpret_cast<const int32_t *>(data));
std::string metaData(reinterpret_cast<const char *>(data), size);
volumeexternal.SetFlags(fsType);
volumeexternal.SetFsType(fsType);
volumeexternal.SetFsUuid(metaData);
volumeexternal.SetPath(metaData);
volumeexternal.SetDescription(metaData);
volumeexternal.GetFlags();;
volumeexternal.GetFsType();
volumeexternal.GetUuid();
volumeexternal.GetPath();