!950 Add hdi test suites --RM.003、RM.005

Merge pull request !950 from jiyong/RM.003
This commit is contained in:
openharmony_ci 2024-01-29 07:02:29 +00:00 committed by Gitee
commit 5201771cc8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 2982 additions and 2143 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -21,8 +21,8 @@ group("HatsHdfCodecTest") {
testonly = true
deps = [
#"benchmarktest:HatsHdfCodecBenchmarkTest",
"benchmarktest_additional:HatsHdfCodecBenchmarkAdditionalTest",
"hdi_adapter:HatsHdfAdapterCodecTest",
"hdi_component_additional:HatsHdfTestComponentCodecAdditionalTest",
"hdi_image:HatsHdfImageCodecTest",
"hdi_image_additional:HatsHdfImageCodecAdditionalTest",
"hdi_omx:HatsHdfOmxCodecTest",

View File

@ -1,4 +1,4 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -18,15 +18,15 @@ import("//test/xts/tools/build/suite.gni")
module_output_path = "hats/codec"
ohos_moduletest_suite("HatsHdfCodecBenchmarkAdditionalTest") {
ohos_moduletest_suite("HatsHdfTestComponentCodecAdditionalTest") {
module_out_path = module_output_path
include_dirs = [
"./",
"//third_party/openmax/api/1.1.2",
]
sources = [
"codec_benchmark_manager_test.cpp",
"codec_callback_service.cpp",
"codec_component_test.cpp",
]
deps = [

View File

@ -1,18 +1,18 @@
{
"kits": [
{
"push": [
"HatsHdfCodecBenchmarkAdditionalTest->/data/local/tmp/HatsHdfCodecBenchmarkAdditionalTest"
],
"type": "PushKit"
}
],
"driver": {
"native-test-timeout": "120000",
"type": "CppTest",
"module-name": "HatsHdfCodecBenchmarkAdditionalTest",
"runtime-hint": "1s",
"native-test-device-path": "/data/local/tmp"
},
"description": "Configuration for HatsHdfCodecBenchmarkAdditionalTest Tests"
{
"kits": [
{
"push": [
"HatsHdfTestComponentCodecAdditionalTest->/data/local/tmp/HatsHdfTestComponentCodecAdditionalTest"
],
"type": "PushKit"
}
],
"driver": {
"native-test-timeout": "120000",
"type": "CppTest",
"module-name": "HatsHdfTestComponentCodecAdditionalTest",
"runtime-hint": "1s",
"native-test-device-path": "/data/local/tmp"
},
"description": "Configuration for HatsHdfTestComponentCodecAdditionalTest Tests"
}

View File

@ -1,46 +1,46 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "v2_0/codec_callback_service.h"
#include <hdf_base.h>
namespace OHOS {
namespace HDI {
namespace Codec {
namespace V2_0 {
int32_t CodecCallbackService::EventHandler(CodecEventType event, const EventInfo &info)
{
(void)event;
(void)info;
return HDF_SUCCESS;
}
int32_t CodecCallbackService::EmptyBufferDone(int64_t appData, const OmxCodecBuffer &buffer)
{
(void)appData;
(void)buffer;
return HDF_SUCCESS;
}
int32_t CodecCallbackService::FillBufferDone(int64_t appData, const OmxCodecBuffer &buffer)
{
(void)appData;
(void)buffer;
return HDF_SUCCESS;
}
} // namespace V2_0
} // namespace Codec
} // namespace HDI
} // namespace OHOS
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "v2_0/codec_callback_service.h"
#include <hdf_base.h>
namespace OHOS {
namespace HDI {
namespace Codec {
namespace V2_0 {
int32_t CodecCallbackService::EventHandler(CodecEventType event, const EventInfo &info)
{
(void)event;
(void)info;
return HDF_SUCCESS;
}
int32_t CodecCallbackService::EmptyBufferDone(int64_t appData, const OmxCodecBuffer &buffer)
{
(void)appData;
(void)buffer;
return HDF_SUCCESS;
}
int32_t CodecCallbackService::FillBufferDone(int64_t appData, const OmxCodecBuffer &buffer)
{
(void)appData;
(void)buffer;
return HDF_SUCCESS;
}
} // namespace V2_0
} // namespace Codec
} // namespace HDI
} // namespace OHOS

View File

@ -1,38 +1,38 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_HDI_CODEC_V2_0_CODECCALLBACKSERVICE_H
#define OHOS_HDI_CODEC_V2_0_CODECCALLBACKSERVICE_H
#include "v2_0/icodec_callback.h"
namespace OHOS {
namespace HDI {
namespace Codec {
namespace V2_0 {
class CodecCallbackService : public ICodecCallback {
public:
CodecCallbackService() = default;
virtual ~CodecCallbackService() = default;
int32_t EventHandler(CodecEventType event, const EventInfo &info) override;
int32_t EmptyBufferDone(int64_t appData, const OmxCodecBuffer &buffer) override;
int32_t FillBufferDone(int64_t appData, const OmxCodecBuffer &buffer) override;
};
} // V1_0
} // Codec
} // HDI
} // OHOS
#endif // OHOS_HDI_CODEC_V1_0_CODECCALLBACKSERVICE_H
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_HDI_CODEC_V2_0_CODECCALLBACKSERVICE_H
#define OHOS_HDI_CODEC_V2_0_CODECCALLBACKSERVICE_H
#include "v2_0/icodec_callback.h"
namespace OHOS {
namespace HDI {
namespace Codec {
namespace V2_0 {
class CodecCallbackService : public ICodecCallback {
public:
CodecCallbackService() = default;
virtual ~CodecCallbackService() = default;
int32_t EventHandler(CodecEventType event, const EventInfo &info) override;
int32_t EmptyBufferDone(int64_t appData, const OmxCodecBuffer &buffer) override;
int32_t FillBufferDone(int64_t appData, const OmxCodecBuffer &buffer) override;
};
} // V2_0
} // Codec
} // HDI
} // OHOS
#endif // OHOS_HDI_CODEC_V1_0_CODECCALLBACKSERVICE_H

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -524,6 +524,31 @@ HWTEST_F(CodecHdiJpegTestAdditional, testInit001, TestSize.Level2)
ASSERT_NE(ret, HDF_SUCCESS);
}
/**
* @tc.number : SUB_Driver_Codec_Init_0200
* @tc.name : testInit002
* @tc.desc : Determines the result of the function with CODEC_IMAGE_JPEG
*/
HWTEST_F(CodecHdiJpegTestAdditional, testInit002, Function | MediumTest | Level1)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
auto ret = hdiJpeg_->DeInit(CODEC_IMAGE_JPEG);
ret = hdiJpeg_->Init(CODEC_IMAGE_JPEG);
ASSERT_EQ(ret, HDF_SUCCESS);
}
/**
* @tc.number : SUB_Driver_Codec_Init_0300
* @tc.name : testInit003
* @tc.desc : Determines the result of the function with CODEC_IMAGE_HEIF
*/
HWTEST_F(CodecHdiJpegTestAdditional, testInit003, Function | MediumTest | Level2)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
auto ret = hdiJpeg_->Init(CODEC_IMAGE_HEIF);
ASSERT_NE(ret, HDF_SUCCESS);
}
/**
* @tc.number : SUB_Driver_Codec_DeInit_0100
* @tc.name : testDeInit001
@ -536,6 +561,31 @@ HWTEST_F(CodecHdiJpegTestAdditional, testDeInit001, TestSize.Level2)
ASSERT_NE(ret, HDF_SUCCESS);
}
/**
* @tc.number : SUB_Driver_Codec_DeInit_0200
* @tc.name : testDeInit002
* @tc.desc : Determines the result of the function with CODEC_IMAGE_JPEG
*/
HWTEST_F(CodecHdiJpegTestAdditional, testDeInit002, Function | MediumTest | Level1)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
auto ret = hdiJpeg_->DeInit(CODEC_IMAGE_JPEG);
ret = hdiJpeg_->DeInit(CODEC_IMAGE_JPEG);
ret = hdiJpeg_->Init(CODEC_IMAGE_JPEG);
}
/**
* @tc.number : SUB_Driver_Codec_DeInit_0300
* @tc.name : testDeInit003
* @tc.desc : Determines the result of the function with CODEC_IMAGE_HEIF
*/
HWTEST_F(CodecHdiJpegTestAdditional, testDeInit003, Function | MediumTest | Level2)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
auto ret = hdiJpeg_->DeInit(CODEC_IMAGE_HEIF);
ASSERT_NE(ret, HDF_SUCCESS);
}
/**
* @tc.number : SUB_Driver_Codec_DoJpegDecode_2100
* @tc.name : testCodecDoJpegDecode013
@ -954,6 +1004,82 @@ HWTEST_F(CodecHdiJpegTestAdditional, testCodecAllocateInBuffer009, TestSize.Leve
ASSERT_NE(ret, HDF_SUCCESS);
}
/**
* @tc.number : SUB_Driver_Codec_AllocateInBuffer_4300
* @tc.name : testCodecAllocateInBuffer010
* @tc.desc : Determines the result of the function with inBuffer.fenceFd = -1 and CODEC_IMAGE_HEIF
*/
HWTEST_F(CodecHdiJpegTestAdditional, testCodecAllocateInBuffer010, Function | MediumTest | Level2)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
struct CodecImageBuffer inBuffer;
inBuffer.fenceFd = -1;
auto ret = hdiJpeg_->AllocateInBuffer(inBuffer, NORMAL_BUFFER_SIZE, CODEC_IMAGE_HEIF);
if (ret == HDF_SUCCESS) {
ret = hdiJpeg_->FreeInBuffer(inBuffer);
ASSERT_EQ(ret, HDF_SUCCESS);
} else {
ASSERT_NE(ret, HDF_SUCCESS);
}
}
/**
* @tc.number : SUB_Driver_Codec_AllocateInBuffer_4400
* @tc.name : testCodecAllocateInBuffer011
* @tc.desc : Determines the result of the function with inBuffer.buffer = 0 and CODEC_IMAGE_HEIF
*/
HWTEST_F(CodecHdiJpegTestAdditional, testCodecAllocateInBuffer011, Function | MediumTest | Level2)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
struct CodecImageBuffer inBuffer;
inBuffer.buffer = 0;
auto ret = hdiJpeg_->AllocateInBuffer(inBuffer, NORMAL_BUFFER_SIZE, CODEC_IMAGE_HEIF);
if (ret == HDF_SUCCESS) {
ret = hdiJpeg_->FreeInBuffer(inBuffer);
ASSERT_EQ(ret, HDF_SUCCESS);
} else {
ASSERT_NE(ret, HDF_SUCCESS);
}
}
/**
* @tc.number : SUB_Driver_Codec_AllocateInBuffer_4500
* @tc.name : testCodecAllocateInBuffer012
* @tc.desc : Determines the result of the function with inBuffer.size = -1 and CODEC_IMAGE_HEIF
*/
HWTEST_F(CodecHdiJpegTestAdditional, testCodecAllocateInBuffer012, Function | MediumTest | Level2)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
struct CodecImageBuffer inBuffer;
inBuffer.size = -1;
auto ret = hdiJpeg_->AllocateInBuffer(inBuffer, NORMAL_BUFFER_SIZE, CODEC_IMAGE_HEIF);
if (ret == HDF_SUCCESS) {
ret = hdiJpeg_->FreeInBuffer(inBuffer);
ASSERT_EQ(ret, HDF_SUCCESS);
} else {
ASSERT_NE(ret, HDF_SUCCESS);
}
}
/**
* @tc.number : SUB_Driver_Codec_AllocateInBuffer_4600
* @tc.name : testCodecAllocateInBuffer013
* @tc.desc : Determines the result of the function with inBuffer.id = -1 and CODEC_IMAGE_HEIF
*/
HWTEST_F(CodecHdiJpegTestAdditional, testCodecAllocateInBuffer013, Function | MediumTest | Level2)
{
ASSERT_TRUE(hdiJpeg_ != nullptr);
struct CodecImageBuffer inBuffer;
inBuffer.id = -1;
auto ret = hdiJpeg_->AllocateInBuffer(inBuffer, NORMAL_BUFFER_SIZE, CODEC_IMAGE_HEIF);
if (ret == HDF_SUCCESS) {
ret = hdiJpeg_->FreeInBuffer(inBuffer);
ASSERT_EQ(ret, HDF_SUCCESS);
} else {
ASSERT_NE(ret, HDF_SUCCESS);
}
}
/**
* @tc.number : SUB_Driver_Codec_FreeInBuffer_4300
* @tc.name : testCodecFreeInBuffer004

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -3642,6 +3642,30 @@ HWTEST_F(DisplayBufferMtAdditional, testDisplayBufferInvalidateCache020, Functio
AfterCache(bHandle);
}
/**
* @tc.number : SUB_Driver_Display_Buffer_FreeMem_0100
* @tc.name : testDisplayBufferFreeMem001
* @tc.desc : Reliability of function(FreeMem)
*/
HWTEST_F(DisplayBufferMtAdditional, testDisplayBufferFreeMem001, Function | MediumTest | Level1)
{
BufferHandle *bHandle = nullptr;
AllocInfo info;
info.width = 1024;
info.height = 1024;
info.usage = OHOS::HDI::Display::Composer::V1_0::HBM_USE_CPU_WRITE;
info.format = PIXEL_FMT_BGRA_8888;
g_dispbuf->AllocMem(info, bHandle);
g_dispbuf->FreeMem(*bHandle);
void *buffer = g_dispbuf->Mmap(*bHandle);
#ifdef DISPLAY_COMMUNITY
EXPECT_TRUE(buffer == reinterpret_cast<void *>(0xffffffff));
#else
EXPECT_TRUE(buffer == nullptr);
#endif // DISPLAY_COMMUNITY
}
} // namespace TEST
} // namespace Display
} // namespace HDI