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 "$hiview_base/utility/include", 24 ] 25 26 cflags = [ "-D__UNITTEST__" ] 27 if (has_hiperf) { 28 cflags += [ "-DHAS_HIPERF" ] 29 } 30} 31 32ohos_unittest("UCollectionUtilityUnitTest") { 33 module_out_path = "hiviewdfx/hiview" 34 35 configs = [ ":ucollection_utility_test_config" ] 36 37 sources = [ 38 "$hiview_framework/native/unified_collection/collector/utils/trace_manager.cpp", 39 "$hiview_framework/native/unified_collection/collector/utils/trace_utils.cpp", 40 "cpu_collector_test.cpp", 41 "gpu_collector_test.cpp", 42 "graphic_memory_collector_test.cpp", 43 "hiebpf_collector_test.cpp", 44 "hilog_collector_test.cpp", 45 "io_collector_test.cpp", 46 "memory_collector_test.cpp", 47 "network_collector_test.cpp", 48 "perf_collector_test.cpp", 49 "trace_collector_test.cpp", 50 "wm_collector_test.cpp", 51 ] 52 53 if (has_hiprofiler) { 54 sources += [ "mem_profiler_collector_test.cpp" ] 55 } 56 57 cflags_cc = [] 58 59 deps = [ 60 "$hiview_base/event_report:hiview_event_report", 61 "$hiview_base/utility:hiview_utility", 62 "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_graphic", 63 "$hiview_interfaces/inner_api/unified_collection/utility:libucollection_utility", 64 ] 65 66 external_deps = [ 67 "access_token:libaccesstoken_sdk", 68 "access_token:libnativetoken", 69 "access_token:libtoken_setproc", 70 "ffrt:libffrt", 71 "googletest:gtest_main", 72 "hilog:libhilog", 73 "hitrace:hitrace_dump", 74 "init:libbegetutil", 75 "zlib:libz", 76 ] 77 78 if (has_hiprofiler) { 79 external_deps += [ "hiprofiler:libnative_daemon_client" ] 80 } 81 82 if (has_hiperf) { 83 cflags = [ "-DHAS_HIPERF" ] 84 } 85 86 defines = [] 87 if (is_wifi_enable) { 88 external_deps += [ "wifi:wifi_sdk" ] 89 defines += [ "COMMUNICATION_WIFI_ENABLE" ] 90 } 91} 92