1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/test.gni") 15 16module_output_path = "hiviewdfx/hitrace" 17 18config("module_private_config") { 19 visibility = [ ":*" ] 20 include_dirs = [ 21 "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include", 22 "//base/hiviewdfx/hilog/frameworks/native/include", 23 "//commonlibrary/c_utils/base/include", 24 ] 25} 26 27ohos_unittest("HitraceCTest") { 28 module_out_path = module_output_path 29 30 sources = [ 31 "//base/hiviewdfx/hitrace/frameworks/native/hitracechainc.c", 32 "unittest/common/native/hitracechainc_test.cpp", 33 ] 34 35 configs = [ ":module_private_config" ] 36 37 deps = [ "//third_party/googletest:gtest_main" ] 38 39 external_deps = [ 40 "c_utils:utils", 41 "hilog_native:libhilog", 42 ] 43} 44 45ohos_unittest("HitraceCppTest") { 46 module_out_path = module_output_path 47 48 sources = [ 49 "//base/hiviewdfx/hitrace/frameworks/native/hitracechain.cpp", 50 "//base/hiviewdfx/hitrace/frameworks/native/hitracechainc.c", 51 "//base/hiviewdfx/hitrace/frameworks/native/hitraceid.cpp", 52 "unittest/common/native/hitracechaincpp_test.cpp", 53 ] 54 55 configs = [ ":module_private_config" ] 56 57 deps = [ "//third_party/googletest:gtest_main" ] 58 59 external_deps = [ 60 "c_utils:utils", 61 "hilog_native:libhilog", 62 ] 63} 64 65config("HitraceNDKTest_config") { 66 visibility = [ ":*" ] 67 68 include_dirs = [ 69 "//base/hiviewdfx/hitrace/cmd/include", 70 "//base/hiviewdfx/hitrace/interfaces/native/innerkits/include/hitrace_meter", 71 ] 72} 73 74ohos_unittest("HitraceNDKTest") { 75 module_out_path = module_output_path 76 77 sources = [ "unittest/hitrace_meter/hitrace_ndk_test.cpp" ] 78 79 configs = [ ":HitraceNDKTest_config" ] 80 81 deps = [ 82 "//base/hiviewdfx/hitrace/cmd:hitrace_osal_inner", 83 "//base/hiviewdfx/hitrace/interfaces/native/innerkits:hitrace_meter", 84 "//third_party/googletest:gtest_main", 85 ] 86 87 external_deps = [ 88 "hilog_native:libhilog", 89 "init:libbegetutil", 90 ] 91} 92 93group("unittest") { 94 testonly = true 95 deps = [ 96 ":HitraceCTest", 97 ":HitraceCppTest", 98 ":HitraceNDKTest", 99 ] 100 if (support_jsapi) { 101 deps += [ "unittest/common/napi:unittest" ] 102 } 103} 104