1# Copyright (c) 2023-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/test.gni") 16 17config("ucollection_utility_test_config") { 18 visibility = [ ":*" ] 19 20 include_dirs = [ 21 ".", 22 "$hiview_framework/native/unified_collection/collector/inner_include", 23 ] 24 25 cflags = [ "-D__UNITTEST__" ] 26} 27 28ohos_unittest("UCollectionUtilityUnitTest") { 29 module_out_path = "hiviewdfx/hiview" 30 31 configs = [ ":ucollection_utility_test_config" ] 32 33 sources = [ 34 "cpu_collector_test.cpp", 35 "gpu_collector_test.cpp", 36 "graphic_memory_collector_test.cpp", 37 "hiebpf_collector_test.cpp", 38 "hilog_collector_test.cpp", 39 "io_collector_test.cpp", 40 "memory_collector_test.cpp", 41 "network_collector_test.cpp", 42 "perf_collector_test.cpp", 43 "thermal_collector_test.cpp", 44 "wm_collector_test.cpp", 45 ] 46 47 deps = [ 48 "$hiview_base:hiviewbase", 49 "$hiview_base/event_report:hiview_event_report", 50 "$hiview_base/utility:hiview_utility", 51 "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility", 52 ] 53 54 external_deps = [ 55 "access_token:libaccesstoken_sdk", 56 "access_token:libnativetoken", 57 "access_token:libtoken_setproc", 58 "ffrt:libffrt", 59 "googletest:gtest_main", 60 "hilog:libhilog", 61 "hisysevent:libhisysevent", 62 "init:libbegetutil", 63 "zlib:libz", 64 ] 65 66 defines = [] 67 if (hiview_unified_collector_ebpf_enable) { 68 defines += [ "UNIFIED_COLLECTOR_EBPF_ENABLE" ] 69 } 70 71 if (hiview_unified_collector_network_enable) { 72 defines += [ "UNIFIED_COLLECTOR_NETWORK_ENABLE" ] 73 } 74 75 if (hiview_unified_collector_graphic_enable) { 76 defines += [ "UNIFIED_COLLECTOR_GRAPHIC_ENABLE" ] 77 } 78 79 if (hiview_unified_collector_gpu_enable) { 80 defines += [ "UNIFIED_COLLECTOR_GPU_ENABLE" ] 81 } 82 83 if (hiview_unified_collector_cpu_enable) { 84 defines += [ "UNIFIED_COLLECTOR_CPU_ENABLE" ] 85 } 86 87 if (hiview_unified_collector_io_enable) { 88 defines += [ "UNIFIED_COLLECTOR_IO_ENABLE" ] 89 } 90 91 if (hiview_unified_collector_memory_enable) { 92 defines += [ "UNIFIED_COLLECTOR_MEMORY_ENABLE" ] 93 } 94 95 if (hiview_unified_collector_hilog_enable) { 96 defines += [ "UNIFIED_COLLECTOR_HILOG_ENABLE" ] 97 } 98 99 if (hiview_unified_collector_wm_enable) { 100 defines += [ "UNIFIED_COLLECTOR_WM_ENABLE" ] 101 } 102 103 if (hiview_unified_collector_process_enable) { 104 defines += [ "UNIFIED_COLLECTOR_PROCESS_ENABLE" ] 105 } 106 107 cflags = [] 108 if (has_hiperf && hiview_unified_collector_perf_enable) { 109 cflags += [ "-DHAS_HIPERF" ] 110 } 111 112 if (hiview_unified_collector_thermal_enable) { 113 defines += [ "UNIFIED_COLLECTOR_THERMAL_ENABLE" ] 114 } 115 116 if (has_hiprofiler && hiview_unified_collector_mem_profiler_enable) { 117 sources += [ "mem_profiler_collector_test.cpp" ] 118 external_deps += [ "hiprofiler:libnative_daemon_client" ] 119 } 120 121 if (thermal_manager_enable) { 122 cflags += [ "-DTHERMAL_MANAGER_ENABLE" ] 123 } 124 125 if (is_wifi_enable) { 126 external_deps += [ "wifi:wifi_sdk" ] 127 defines += [ "COMMUNICATION_WIFI_ENABLE" ] 128 } 129} 130 131config("ucollection_trace_test_config") { 132 visibility = [ ":*" ] 133 134 include_dirs = [ 135 ".", 136 "$hiview_framework/native/unified_collection/collector/impl/trace/utils/include", 137 "$hiview_framework/native/unified_collection/collector/impl/trace/include", 138 "$hiview_framework/native/unified_collection/trace_manager/include", 139 "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility", 140 ] 141 142 cflags = [ "-D__UNITTEST__" ] 143} 144 145ohos_unittest("UCollectionTraceUnitTest") { 146 module_out_path = "hiviewdfx/hiview" 147 148 configs = [ ":ucollection_trace_test_config" ] 149 150 sources = [ "trace_collector_test.cpp" ] 151 152 deps = [ 153 "$hiview_base:hiviewbase", 154 "$hiview_base/event_report:hiview_event_report", 155 "$hiview_base/utility:hiview_utility", 156 "$hiview_framework/native/unified_collection/trace_manager:libtrace_manager", 157 "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility", 158 ] 159 160 external_deps = [ 161 "access_token:libaccesstoken_sdk", 162 "access_token:libnativetoken", 163 "access_token:libtoken_setproc", 164 "ffrt:libffrt", 165 "googletest:gtest_main", 166 "hilog:libhilog", 167 "init:libbegetutil", 168 "zlib:libz", 169 ] 170 171 defines = [ "UNIFIED_COLLECTOR_TRACE_ENABLE" ] 172} 173