• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "abseil-cpp:absl_cord",
41    "abseil-cpp:absl_log",
42    "bounds_checking_function:libsec_shared",
43    "c_utils:utils",
44    "googletest:gtest",
45    "grpc:gpr",
46    "grpc:grpc",
47    "grpc:grpcxx",
48    "hilog:libhilog_base",
49    "protobuf:protobuf_lite",
50  ]
51
52  external_deps += [
53    "bounds_checking_function:libsec_shared",
54    "init:libbegetutil",
55    "openssl:libcrypto_shared",
56  ]
57
58  defines = []
59  if (current_toolchain != host_toolchain) {
60    external_deps += [ "hilog:libhilog_base" ]
61  }
62
63  include_dirs = [
64    "${network_profiler_path}/client/include",
65    "${OHOS_PROFILER_DIR}/device/plugins/api/include",
66    "${OHOS_PROFILER_DIR}/device/plugins/api/src",
67    "${OHOS_PROFILER_DIR}/interfaces/kits",
68    "${OHOS_PROFILER_DIR}/device/base/include",
69  ]
70  include_dirs += [
71    "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service/include",
72    "${OHOS_PROFILER_DIR}/device/services/ipc/include",
73    "${OHOS_PROFILER_DIR}/device/services/shared_memory/include",
74    "${OHOS_PROFILER_DIR}/device/services/plugin_service/include",
75    "${OHOS_PROFILER_DIR}/interfaces/kits",
76    "${OHOS_PROFILER_DIR}/device/plugins/api/include",
77    "${OHOS_PROFILER_DIR}/device/base/include",
78  ]
79  cflags = [
80    "-DNETWORK_UNITTEST",
81    "-Wno-inconsistent-missing-override",
82    "-Dprivate=public",  #allow test code access private members
83    "-Dprotected=public",  #allow test code access private members
84  ]
85
86  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
87}
88
89group("unittest") {
90  testonly = true
91  deps = [ ":networkprofiler_ut" ]
92}
93