1b0e7dd80Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd. 2b0e7dd80Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3b0e7dd80Sopenharmony_ci# you may not use this file except in compliance with the License. 4b0e7dd80Sopenharmony_ci# You may obtain a copy of the License at 5b0e7dd80Sopenharmony_ci# 6b0e7dd80Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7b0e7dd80Sopenharmony_ci# 8b0e7dd80Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9b0e7dd80Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10b0e7dd80Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11b0e7dd80Sopenharmony_ci# See the License for the specific language governing permissions and 12b0e7dd80Sopenharmony_ci# limitations under the License. 13b0e7dd80Sopenharmony_ci 14b0e7dd80Sopenharmony_ciimport("//base/hiviewdfx/hitrace/hitrace.gni") 15b0e7dd80Sopenharmony_ciimport("//build/ohos.gni") 16b0e7dd80Sopenharmony_ciimport("//build/test.gni") 17b0e7dd80Sopenharmony_ci 18b0e7dd80Sopenharmony_cimodule_output_path = "hiviewdfx/hitrace" 19b0e7dd80Sopenharmony_ci 20b0e7dd80Sopenharmony_ciconfig("module_private_config") { 21b0e7dd80Sopenharmony_ci visibility = [ ":*" ] 22b0e7dd80Sopenharmony_ci include_dirs = [ 23b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/include", 24b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/include", 25b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/include/hitrace_meter", 26b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/include/hitrace", 27b0e7dd80Sopenharmony_ci ] 28b0e7dd80Sopenharmony_ci} 29b0e7dd80Sopenharmony_ci 30b0e7dd80Sopenharmony_ciohos_unittest("HitraceCTest") { 31b0e7dd80Sopenharmony_ci module_out_path = module_output_path 32b0e7dd80Sopenharmony_ci 33b0e7dd80Sopenharmony_ci sources = [ 34b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/hitracechain.cpp", 35b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/hitracechainc.c", 36b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/hitraceid.cpp", 37b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter.cpp", 38b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter_c.c", 39b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter_wrapper.cpp", 40b0e7dd80Sopenharmony_ci "common/native/hitracechainc_test.cpp", 41b0e7dd80Sopenharmony_ci ] 42b0e7dd80Sopenharmony_ci 43b0e7dd80Sopenharmony_ci configs = [ ":module_private_config" ] 44b0e7dd80Sopenharmony_ci 45b0e7dd80Sopenharmony_ci external_deps = [ 46b0e7dd80Sopenharmony_ci "bounds_checking_function:libsec_shared", 47b0e7dd80Sopenharmony_ci "googletest:gtest_main", 48b0e7dd80Sopenharmony_ci "init:libbegetutil", 49b0e7dd80Sopenharmony_ci ] 50b0e7dd80Sopenharmony_ci if (defined(ohos_lite)) { 51b0e7dd80Sopenharmony_ci external_deps += [ "hilog_lite:hilog_lite" ] 52b0e7dd80Sopenharmony_ci } else { 53b0e7dd80Sopenharmony_ci external_deps += [ "hilog:libhilog" ] 54b0e7dd80Sopenharmony_ci } 55b0e7dd80Sopenharmony_ci} 56b0e7dd80Sopenharmony_ci 57b0e7dd80Sopenharmony_ciohos_unittest("HitraceCppTest") { 58b0e7dd80Sopenharmony_ci module_out_path = module_output_path 59b0e7dd80Sopenharmony_ci 60b0e7dd80Sopenharmony_ci sources = [ 61b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/hitracechain.cpp", 62b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/hitracechainc.c", 63b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/hitraceid.cpp", 64b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter.cpp", 65b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter_c.c", 66b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter_wrapper.cpp", 67b0e7dd80Sopenharmony_ci "common/native/hitracechaincpp_test.cpp", 68b0e7dd80Sopenharmony_ci ] 69b0e7dd80Sopenharmony_ci 70b0e7dd80Sopenharmony_ci configs = [ ":module_private_config" ] 71b0e7dd80Sopenharmony_ci 72b0e7dd80Sopenharmony_ci external_deps = [ 73b0e7dd80Sopenharmony_ci "bounds_checking_function:libsec_shared", 74b0e7dd80Sopenharmony_ci "googletest:gtest_main", 75b0e7dd80Sopenharmony_ci "init:libbegetutil", 76b0e7dd80Sopenharmony_ci ] 77b0e7dd80Sopenharmony_ci if (defined(ohos_lite)) { 78b0e7dd80Sopenharmony_ci external_deps += [ "hilog_lite:hilog_lite" ] 79b0e7dd80Sopenharmony_ci } else { 80b0e7dd80Sopenharmony_ci external_deps += [ "hilog:libhilog" ] 81b0e7dd80Sopenharmony_ci } 82b0e7dd80Sopenharmony_ci} 83b0e7dd80Sopenharmony_ci 84b0e7dd80Sopenharmony_ciconfig("HitraceNDKTest_config") { 85b0e7dd80Sopenharmony_ci visibility = [ ":*" ] 86b0e7dd80Sopenharmony_ci 87b0e7dd80Sopenharmony_ci include_dirs = [ 88b0e7dd80Sopenharmony_ci "$hitrace_cmd_path/include", 89b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/include/hitrace_meter", 90b0e7dd80Sopenharmony_ci ] 91b0e7dd80Sopenharmony_ci} 92b0e7dd80Sopenharmony_ci 93b0e7dd80Sopenharmony_ciohos_unittest("HitraceNDKTest") { 94b0e7dd80Sopenharmony_ci module_out_path = module_output_path 95b0e7dd80Sopenharmony_ci 96b0e7dd80Sopenharmony_ci sources = [ 97b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_meter.cpp", 98b0e7dd80Sopenharmony_ci "hitrace_meter/hitrace_ndk_test.cpp", 99b0e7dd80Sopenharmony_ci ] 100b0e7dd80Sopenharmony_ci 101b0e7dd80Sopenharmony_ci configs = [ ":HitraceNDKTest_config" ] 102b0e7dd80Sopenharmony_ci 103b0e7dd80Sopenharmony_ci cflags = [ "-DHITRACE_UNITTEST" ] 104b0e7dd80Sopenharmony_ci 105b0e7dd80Sopenharmony_ci deps = [ 106b0e7dd80Sopenharmony_ci "$hitrace_cmd_path:hitrace_osal_inner", 107b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits:hitrace_meter", 108b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits:libhitracechain", 109b0e7dd80Sopenharmony_ci ] 110b0e7dd80Sopenharmony_ci 111b0e7dd80Sopenharmony_ci external_deps = [ 112b0e7dd80Sopenharmony_ci "bounds_checking_function:libsec_shared", 113b0e7dd80Sopenharmony_ci "googletest:gtest_main", 114b0e7dd80Sopenharmony_ci "init:libbegetutil", 115b0e7dd80Sopenharmony_ci ] 116b0e7dd80Sopenharmony_ci if (defined(ohos_lite)) { 117b0e7dd80Sopenharmony_ci external_deps += [ "hilog_lite:hilog_lite" ] 118b0e7dd80Sopenharmony_ci } else { 119b0e7dd80Sopenharmony_ci external_deps += [ "hilog:libhilog" ] 120b0e7dd80Sopenharmony_ci } 121b0e7dd80Sopenharmony_ci} 122b0e7dd80Sopenharmony_ci 123b0e7dd80Sopenharmony_ciohos_unittest("HitraceDumpTest") { 124b0e7dd80Sopenharmony_ci module_out_path = module_output_path 125b0e7dd80Sopenharmony_ci 126b0e7dd80Sopenharmony_ci sources = [ 127b0e7dd80Sopenharmony_ci "$hitrace_cmd_path/src/hitrace_osal.cpp", 128b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/common_utils.cpp", 129b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/native/dynamic_buffer.cpp", 130b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/src/hitrace_dump.cpp", 131b0e7dd80Sopenharmony_ci "hitrace_dump/hitrace_dump_test.cpp", 132b0e7dd80Sopenharmony_ci ] 133b0e7dd80Sopenharmony_ci 134b0e7dd80Sopenharmony_ci cflags = [ "-DHITRACE_UNITTEST" ] 135b0e7dd80Sopenharmony_ci 136b0e7dd80Sopenharmony_ci include_dirs = [ 137b0e7dd80Sopenharmony_ci "$hitrace_cmd_path/include", 138b0e7dd80Sopenharmony_ci "$hitrace_frameworks_path/include", 139b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits/include", 140b0e7dd80Sopenharmony_ci "$hitrace_utils_path", 141b0e7dd80Sopenharmony_ci ] 142b0e7dd80Sopenharmony_ci 143b0e7dd80Sopenharmony_ci deps = [ 144b0e7dd80Sopenharmony_ci "$hitrace_interfaces_path/native/innerkits:hitrace_meter", 145b0e7dd80Sopenharmony_ci "$hitrace_utils_path:hitrace_utils", 146b0e7dd80Sopenharmony_ci ] 147b0e7dd80Sopenharmony_ci 148b0e7dd80Sopenharmony_ci external_deps = [ 149b0e7dd80Sopenharmony_ci "bounds_checking_function:libsec_shared", 150b0e7dd80Sopenharmony_ci "cJSON:cjson", 151b0e7dd80Sopenharmony_ci "googletest:gtest_main", 152b0e7dd80Sopenharmony_ci "init:libbegetutil", 153b0e7dd80Sopenharmony_ci ] 154b0e7dd80Sopenharmony_ci if (defined(ohos_lite)) { 155b0e7dd80Sopenharmony_ci external_deps += [ "hilog_lite:hilog_lite" ] 156b0e7dd80Sopenharmony_ci } else { 157b0e7dd80Sopenharmony_ci external_deps += [ "hilog:libhilog" ] 158b0e7dd80Sopenharmony_ci } 159b0e7dd80Sopenharmony_ci} 160