1# Copyright (c) 2024 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("//base/hiviewdfx/hiview/hiview.gni") 15import("//build/ohos.gni") 16import("//build/test.gni") 17 18module_output_path = "hiview/hiview/leak_detector" 19 20config("leak_detector_test_config") { 21 visibility = [ ":*" ] 22 include_dirs = [ 23 ".", 24 "..", 25 "../base", 26 "../native_leak", 27 "$hiview_base/event_raw/include", 28 "$hiview_base/event_publish/include", 29 "$hiview_base/include", 30 "$hiview_base/logstore/include", 31 "$hiview_base/utility/include", 32 "$hiview_root/include", 33 "$hiview_root/interfaces/inner_api/unified_collection", 34 "$hiview_root/interfaces/inner_api/unified_collection/utility", 35 "$hiview_plugin/faultlogger/common", 36 "$hiview_plugin/faultlogger/service", 37 ] 38} 39 40ohos_unittest("LeakDetectorUnitTest") { 41 module_out_path = module_output_path 42 43 if (hiview_enable_leak_detector) { 44 part_name = "hiview" 45 subsystem_name = "hiviewdfx" 46 47 sources = [ 48 "../native_leak/native_leak_config.cpp", 49 "test_util.cpp", 50 "unittest/leak_detector_unit_test.cpp", 51 ] 52 53 configs = [ ":leak_detector_test_config" ] 54 55 cflags = [ "-DUNITTEST" ] 56 57 external_deps = [ 58 "bundle_framework:appexecfwk_base", 59 "bundle_framework:appexecfwk_core", 60 "c_utils:utils", 61 "ffrt:libffrt", 62 "hilog:libhilog", 63 "hiprofiler:libnative_daemon_client", 64 "hisysevent:libhisysevent", 65 "init:libbegetutil", 66 ] 67 68 if (has_hiprofiler) { 69 cflags += [ "-DHAS_HIPROFILER" ] 70 } 71 } 72} 73 74ohos_moduletest("LeakDetectorModuleTest") { 75 module_out_path = module_output_path 76 77 if (hiview_enable_leak_detector) { 78 part_name = "hiview" 79 subsystem_name = "hiviewdfx" 80 81 sources = [ 82 "moduletest/leak_detector_module_test.cpp", 83 "test_util.cpp", 84 ] 85 86 configs = [ ":leak_detector_test_config" ] 87 88 cflags = [ "-DMOUDLETEST" ] 89 90 external_deps = [ 91 "bundle_framework:appexecfwk_base", 92 "bundle_framework:appexecfwk_core", 93 "c_utils:utils", 94 "ffrt:libffrt", 95 "hilog:libhilog", 96 "hiprofiler:libnative_daemon_client", 97 "hisysevent:libhisysevent", 98 "init:libbegetutil", 99 ] 100 101 if (has_hiprofiler) { 102 cflags += [ "-DHAS_HIPROFILER" ] 103 } 104 } 105} 106