• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) Huawei Technologies Co., Ltd. 2021. 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/ohos.gni")
15import("//build/test.gni")
16import("../../../base/config.gni")
17
18module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device"
19config("module_private_config") {
20  visibility = [ ":*" ]
21  if (current_toolchain != host_toolchain) {
22    defines = [ "HAVE_HILOG" ]
23  }
24}
25
26ohos_executable("ffrt_profiler_test_exe") {
27  output_name = "ffrt_profiler_test_exe"
28
29  sources = [ "unittest/ffrt_profiler_test_exec.cpp" ]
30
31  defines = []
32  external_deps = []
33
34  external_deps += [
35    "bounds_checking_function:libsec_shared",
36    "ffrt:libffrt",
37    "init:libbegetutil",
38  ]
39
40  if (current_toolchain != host_toolchain) {
41    defines += [ "HAVE_HILOG" ]
42    external_deps += [ "hilog:libhilog_base" ]
43  }
44
45  install_enable = false
46  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
47  part_name = "${OHOS_PROFILER_PART_NAME}"
48}
49
50ohos_unittest("ffrt_profiler_ut") {
51  module_out_path = module_output_path
52
53  include_dirs = [
54    "${OHOS_PROFILER_DIR}/device/base/include",
55    "../service/include",
56    "${OHOS_PROFILER_DIR}/device/services/ipc/include",
57    "${OHOS_PROFILER_DIR}/device/services/shared_memory/include",
58    "${OHOS_PROFILER_DIR}/interfaces/kits",
59    "${OHOS_PROFILER_DIR}/device/plugins/api/include",
60    "${OHOS_PROFILER_DIR}/device/plugins/api/src",
61  ]
62
63  sources = [
64    "${OHOS_PROFILER_DIR}/device/plugins/api/src/buffer_writer.cpp",
65    "${OHOS_PROFILER_DIR}/device/plugins/api/src/command_poller.cpp",
66    "${OHOS_PROFILER_DIR}/device/plugins/api/src/writer_adapter.cpp",
67    "../service/src/ffrt_profiler_common.cpp",
68    "../service/src/ffrt_profiler_handle.cpp",
69    "../service/src/ffrt_profiler_manager.cpp",
70    "../service/src/ffrt_profiler_socket_service.cpp",
71    "unittest/ffrt_profiler_test.cpp",
72  ]
73
74  public_deps = [
75    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base",
76    "${OHOS_PROFILER_DIR}/device/plugins/network_profiler/service:network_profiler_service",
77    "${OHOS_PROFILER_DIR}/device/services/ipc:ipc",
78    "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory",
79    "${OHOS_PROFILER_DIR}/proto_encoder:proto_encoder_source",
80    "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto",
81    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source",
82    "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_cpp",
83    "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_encoder",
84  ]
85
86  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
87
88  cflags = [
89    "-Wno-inconsistent-missing-override",
90    "-Dprivate=public",  #allow test code access private members
91  ]
92
93  external_deps = [
94    "bounds_checking_function:libsec_shared",
95    "c_utils:utils",
96    "googletest:gtest",
97    "hilog:libhilog_base",
98    "init:libbegetutil",
99    "protobuf:protobuf_lite",
100  ]
101  configs = [ ":module_private_config" ]
102  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
103  part_name = "${OHOS_PROFILER_PART_NAME}"
104  resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml"
105}
106
107group("unittest") {
108  testonly = true
109  deps = [
110    ":ffrt_profiler_test_exe",
111    ":ffrt_profiler_ut",
112  ]
113}
114