add testcase

Signed-off-by: 50034454 <xiaxiang5@huawei.com>
Change-Id: I7db3456c76e3887ae8bc30bf590665c3a8457072
This commit is contained in:
50034454 2023-08-25 10:39:35 +08:00
parent c8ad1854e2
commit 8be5adc627
3 changed files with 48 additions and 27 deletions

View File

@ -14,18 +14,36 @@
import("//build/ohos.gni")
## buffer_handle.so {{{
config("buffer_handle_config") {
visibility = [ ":buffer_handle" ]
cflags = [
"-Wall",
"-Werror",
"-g3",
"-Wno-error=missing-braces",
"-Wno-error=#warnings",
]
}
config("buffer_handle_public_config") {
include_dirs = [
"export",
"//drivers/peripheral/base",
"../../../../../communication/ipc/interfaces/innerkits/ipc_core/include/message_parcel.h",
"//commonlibrary/c_utils/base/include",
"//base/hiviewdfx/hilog/interfaces/native/innerkits",
"//base/notification/eventhandler/interfaces/inner_api",
"//foundation/graphic/graphic_2d/utils/log",
]
}
ohos_static_library("buffer_handle") {
sources = [ "src/buffer_handle.cpp" ]
configs = [ "//commonlibrary/c_utils/base:utils_config" ]
configs = [
":buffer_handle_config",
"//commonlibrary/c_utils/base:utils_config",
]
public_configs = [ ":buffer_handle_public_config" ]

View File

@ -20,15 +20,22 @@ group("unittest") {
deps = [ ":BufferHandleTest" ]
}
## Build buffer_handle_test
## UnitTest buffer_handle_test {{{
ohos_unittest("BufferHandleTest") {
module_out_path = module_out_path
sources = [ "buffer_handle_test.cpp" ]
include_dirs = [ "//third_party/googletest/googletest/include" ]
deps = [ ":buffer_handle_test_common" ]
external_deps = [ "hilog:libhilog" ]
deps = [
":buffer_handle_test_common",
"../../../../../../communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
]
external_deps = [
"c_utils:utils",
"graphic_2d:buffer_handle",
"hilog:libhilog",
]
}
## Build buffer_handle_test_common.a {{{
config("buffer_handle_test_config") {
cflags = [
"-Wall",
@ -39,18 +46,14 @@ config("buffer_handle_test_config") {
]
}
## UnitTest buffer_handle_test }}}
ohos_static_library("buffer_handle_test_common") {
visibility = [ ":*" ]
testonly = true
public_configs = [ ":buffer_handle_test_config" ]
public_deps = [ "../../../../utils/buffer_handle:buffer_handle" ]
external_deps = [
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
]
subsystem_name = "graphic"
part_name = "graphic_2d"
}
## Build buffer_handle_test_common.a }}}

View File

@ -320,7 +320,7 @@ HWTEST_F(SyncFenceTest, IsValidGetDup001, Function | MediumTest | Level2)
* CaseDescription: 1. call IsValid
* 2. check ret
*/
HWTEST_F(SyncFenceTimelineTest, IsValid001, Function | MediumTest | Level2)
HWTEST_F(SyncFenceTest, IsValid002, Function | MediumTest | Level2)
{
sptr<SyncTimeline> syncTimeline_ = new SyncTimeline();
bool valid = syncTimeline_->IsValid();
@ -329,7 +329,7 @@ HWTEST_F(SyncFenceTimelineTest, IsValid001, Function | MediumTest | Level2)
int32_t fd = syncTimeline_->GenerateFence("test sw_sync_fence", 1);
sptr<SyncFence> syncFence_ = new SyncFence(fd);
ASSERT_GE(fd, 0);
sptr<SyncFenceTime> syncFenceTime_ = new SyncFenceTime(SyncFence_);
auto syncFenceTime_ = std::make_shared<SyncFenceTime>(syncFence_);
ASSERT_EQ(true, syncFenceTime_->IsValid());
} else {
ASSERT_EQ(valid, false);
@ -344,7 +344,7 @@ HWTEST_F(SyncFenceTimelineTest, IsValid001, Function | MediumTest | Level2)
* CaseDescription: 1. call GetSignalTimestamp
* 2. check ret
*/
HWTEST_F(SyncFenceTimelineTest, GetSignalTimestamp001, Function | MediumTest | Level2)
HWTEST_F(SyncFenceTest, GetSignalTimestamp001, Function | MediumTest | Level2)
{
sptr<SyncTimeline> syncTimeline_ = new SyncTimeline();
bool valid = syncTimeline_->IsValid();
@ -353,9 +353,9 @@ HWTEST_F(SyncFenceTimelineTest, GetSignalTimestamp001, Function | MediumTest | L
int32_t fd = syncTimeline_->GenerateFence("test sw_sync_fence", 1);
sptr<SyncFence> syncFence_ = new SyncFence(fd);
ASSERT_GE(fd, 0);
sptr<SyncFenceTime> syncFenceTime_ = new SyncFenceTime(SyncFence_);
auto syncFenceTime_ = std::make_shared<SyncFenceTime>(syncFence_);
ns_sec_t timestamp = syncFenceTime_->GetSignalTimestamp();
ASSERT_EQ(signaledTimestamps_, timestamp);
ASSERT_EQ(syncFenceTime_->GetCachedSignalTimestamp(), timestamp);
} else {
ASSERT_EQ(valid, false);
}
@ -369,7 +369,7 @@ HWTEST_F(SyncFenceTimelineTest, GetSignalTimestamp001, Function | MediumTest | L
* CaseDescription: 1. call Push
* 2. check ret
*/
HWTEST_F(SyncFenceTimelineTest, Push001, Function | MediumTest | Level2)
HWTEST_F(SyncFenceTest, Push001, Function | MediumTest | Level2)
{
sptr<SyncTimeline> syncTimeline_ = new SyncTimeline();
bool valid = syncTimeline_->IsValid();
@ -378,8 +378,8 @@ HWTEST_F(SyncFenceTimelineTest, Push001, Function | MediumTest | Level2)
int32_t fd = syncTimeline_->GenerateFence("test sw_sync_fence", 1);
sptr<SyncFence> syncFence_ = new SyncFence(fd);
ASSERT_GE(fd, 0);
auto syncFenceTime_ = std::make_shared<SyncFenceTime>(fd);
SyncFenceTimeline syncFenceTimeline_ = new SyncFenceTimeline();
auto syncFenceTime_ = std::make_shared<SyncFenceTime>(syncFence_);
auto syncFenceTimeline_ = std::make_shared<SyncFenceTimeline>();
syncFenceTimeline_->Push(syncFenceTime_);
} else {
ASSERT_EQ(valid, false);
@ -394,7 +394,7 @@ HWTEST_F(SyncFenceTimelineTest, Push001, Function | MediumTest | Level2)
* CaseDescription: 1. call UpdateFenceTimeline
* 2. check ret
*/
HWTEST_F(SyncFenceTimelineTest, UpdateFenceTimeline001, Function | MediumTest | Level2)
HWTEST_F(SyncFenceTest, UpdateFenceTimeline001, Function | MediumTest | Level2)
{
sptr<SyncTimeline> syncTimeline_ = new SyncTimeline();
bool valid = syncTimeline_->IsValid();
@ -403,8 +403,8 @@ HWTEST_F(SyncFenceTimelineTest, UpdateFenceTimeline001, Function | MediumTest |
int32_t fd = syncTimeline_->GenerateFence("test sw_sync_fence", 1);
sptr<SyncFence> syncFence_ = new SyncFence(fd);
ASSERT_GE(fd, 0);
auto syncFenceTime_ = std::make_shared<SyncFenceTime>(fd);
SyncFenceTimeline syncFenceTimeline_ = new SyncFenceTimeline();
auto syncFenceTime_ = std::make_shared<SyncFenceTime>(syncFence_);
auto syncFenceTimeline_ = std::make_shared<SyncFenceTimeline>();
syncFenceTimeline_->UpdateFenceTimeline();
syncFenceTimeline_->Push(syncFenceTime_);
syncFenceTimeline_->UpdateFenceTimeline();
@ -422,9 +422,9 @@ HWTEST_F(SyncFenceTimelineTest, UpdateFenceTimeline001, Function | MediumTest |
* CaseDescription: 1. call SyncFenceTracker
* 2. check ret
*/
HWTEST_F(SyncFenceTrackerTest, SyncFenceTrackerTest, Function | MediumTest | Level2)
HWTEST_F(SyncFenceTest, SyncFenceTrackerTest, Function | MediumTest | Level2)
{
auto tracker = std::make_shared<SyncFenceTrackerTest>("test sw_sync_fence1");
auto tracker = std::make_shared<SyncFenceTracker>("test sw_sync_fence1");
}
/*
@ -435,7 +435,7 @@ HWTEST_F(SyncFenceTrackerTest, SyncFenceTrackerTest, Function | MediumTest | Lev
* CaseDescription: 1. call TrackFence, call Loop
* 2. check ret
*/
HWTEST_F(SyncFenceTrackerTest, TrackFenceTest, Function | MediumTest | Level2)
HWTEST_F(SyncFenceTest, TrackFenceTest, Function | MediumTest | Level2)
{
sptr<SyncTimeline> syncTimeline_ = new SyncTimeline();
bool valid = syncTimeline_->IsValid();