# Copyright (c) 2021-2022 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. import("//build/test.gni") module_output_path = "hiviewdfx/hitrace" config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "../interfaces/native/innerkits/include", "../frameworks/include", "../interfaces/native/innerkits/include/hitrace_meter", "../interfaces/native/innerkits/include/hitrace", ] } ohos_unittest("HitraceCTest") { module_out_path = module_output_path sources = [ "../frameworks/native/hitracechain.cpp", "../frameworks/native/hitracechainc.c", "../frameworks/native/hitraceid.cpp", "../interfaces/native/innerkits/src/hitrace_meter.cpp", "../interfaces/native/innerkits/src/hitrace_meter_c.c", "../interfaces/native/innerkits/src/hitrace_meter_wrapper.cpp", "unittest/common/native/hitracechainc_test.cpp", ] configs = [ ":module_private_config" ] deps = [ "//third_party/googletest:gtest_main" ] external_deps = [] if (defined(ohos_lite)) { external_deps += [ "hilog_lite:hilog_lite" ] } else { external_deps += [ "hilog:libhilog" ] } external_deps += [ "bounds_checking_function:libsec_static", "init:libbegetutil", ] } ohos_unittest("HitraceCppTest") { module_out_path = module_output_path sources = [ "../frameworks/native/hitracechain.cpp", "../frameworks/native/hitracechainc.c", "../frameworks/native/hitraceid.cpp", "../interfaces/native/innerkits/src/hitrace_meter.cpp", "../interfaces/native/innerkits/src/hitrace_meter_c.c", "../interfaces/native/innerkits/src/hitrace_meter_wrapper.cpp", "unittest/common/native/hitracechaincpp_test.cpp", ] configs = [ ":module_private_config" ] deps = [ "//third_party/googletest:gtest_main" ] external_deps = [] if (defined(ohos_lite)) { external_deps += [ "hilog_lite:hilog_lite" ] } else { external_deps += [ "hilog:libhilog" ] } external_deps += [ "bounds_checking_function:libsec_static", "init:libbegetutil", ] } config("HitraceNDKTest_config") { visibility = [ ":*" ] include_dirs = [ "../cmd/include", "../interfaces/native/innerkits/include/hitrace_meter", ] } ohos_unittest("HitraceNDKTest") { module_out_path = module_output_path sources = [ "../interfaces/native/innerkits/src/hitrace_meter.cpp", "unittest/hitrace_meter/hitrace_ndk_test.cpp", ] configs = [ ":HitraceNDKTest_config" ] cflags = [ "-DHITRACE_UNITTEST" ] deps = [ "../cmd:hitrace_osal_inner", "../interfaces/native/innerkits:hitrace_meter", "../interfaces/native/innerkits:libhitracechain", "//third_party/googletest:gtest_main", ] external_deps = [ "init:libbegetutil" ] if (defined(ohos_lite)) { external_deps += [ "hilog_lite:hilog_lite" ] } else { external_deps += [ "hilog:libhilog" ] } external_deps += [ "bounds_checking_function:libsec_static" ] } ohos_unittest("HitraceDumpTest") { module_out_path = module_output_path sources = [ "../frameworks/native/common_utils.cpp", "../frameworks/native/dynamic_buffer.cpp", "../interfaces/native/innerkits/src/hitrace_dump.cpp", "unittest/hitrace_dump/hitrace_dump_test.cpp", ] cflags = [ "-DHITRACE_UNITTEST" ] include_dirs = [ "../frameworks/include/", "../interfaces/native/innerkits/include", ] deps = [ "../interfaces/native/innerkits:hitrace_dump", "//third_party/googletest:gtest_main", ] external_deps = [ "bounds_checking_function:libsec_static", "cJSON:cjson", "init:libbegetutil", ] if (defined(ohos_lite)) { external_deps += [ "hilog_lite:hilog_lite" ] } else { external_deps += [ "hilog:libhilog" ] } } group("unittest") { testonly = true deps = [ ":HitraceCTest", ":HitraceCppTest", ":HitraceDumpTest", ":HitraceNDKTest", ] if (support_jsapi) { deps += [ "unittest/common/napi:unittest" ] } deps += [ "unittest/rust/hitracechain:rust_hitracechain_test" ] }