1# Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. 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") 15import("../../../base/config.gni") 16 17module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device" 18network_profiler_path = "${OHOS_PROFILER_DIR}/device/plugins/network_profiler" 19 20ohos_unittest("networkprofiler_ut") { 21 module_out_path = module_output_path 22 23 sources = [ 24 "${network_profiler_path}/client/src/network_profiler.cpp", 25 "${network_profiler_path}/client/src/network_profiler_socker_client.cpp", 26 "${network_profiler_path}/client/src/network_profiler_write.cpp", 27 "unittest/network_profiler_test.cpp", 28 ] 29 30 deps = [ 31 "${OHOS_PROFILER_DIR}/device/plugins/api:plugins_sources", 32 "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service:network_profiler_service", 33 "${OHOS_PROFILER_DIR}/device/services/plugin_service:hiprofiler_plugin_service", 34 "${OHOS_PROFILER_DIR}/device/services/profiler_service:profiler_service", 35 "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory_lite", 36 ] 37 38 external_deps = [ 39 "abseil-cpp:absl_sync", 40 "bounds_checking_function:libsec_shared", 41 "c_utils:utils", 42 "googletest:gtest", 43 "grpc:grpc", 44 "grpc:grpcxx", 45 "hilog:libhilog_base", 46 "protobuf:protobuf_lite", 47 ] 48 49 external_deps += [ 50 "bounds_checking_function:libsec_shared", 51 "init:libbegetutil", 52 "openssl:libcrypto_shared", 53 ] 54 55 defines = [] 56 if (current_toolchain != host_toolchain) { 57 external_deps += [ "hilog:libhilog_base" ] 58 } 59 60 include_dirs = [ 61 "${network_profiler_path}/client/include", 62 "${OHOS_PROFILER_DIR}/device/plugins/api/include", 63 "${OHOS_PROFILER_DIR}/device/plugins/api/src", 64 "${OHOS_PROFILER_DIR}/interfaces/kits", 65 "${OHOS_PROFILER_DIR}/device/base/include", 66 ] 67 include_dirs += [ 68 "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service/include", 69 "${OHOS_PROFILER_DIR}/device/services/ipc/include", 70 "${OHOS_PROFILER_DIR}/device/services/shared_memory/include", 71 "${OHOS_PROFILER_DIR}/device/services/plugin_service/include", 72 "${OHOS_PROFILER_DIR}/interfaces/kits", 73 "${OHOS_PROFILER_DIR}/device/plugins/api/include", 74 "${OHOS_PROFILER_DIR}/device/base/include", 75 ] 76 cflags = [ 77 "-Wno-inconsistent-missing-override", 78 "-Dprivate=public", #allow test code access private members 79 "-Dprotected=public", #allow test code access private members 80 ] 81 82 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 83} 84 85group("unittest") { 86 testonly = true 87 deps = [ ":networkprofiler_ut" ] 88} 89