• 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/test.gni")
15import("../../../base/config.gni")
16
17module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device"
18config("module_private_config") {
19  visibility = [ ":*" ]
20  if (current_toolchain != host_toolchain) {
21    defines = [ "HAVE_HILOG" ]
22  }
23}
24
25ohos_unittest("memdataplugin_ut") {
26  module_out_path = module_output_path
27  sources = [
28    "unittest/buffer_splitter_unittest.cpp",
29    "unittest/memory_data_plugin_unittest.cpp",
30  ]
31  deps = [
32    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base",
33    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memdataplugin_source",
34    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memorytest",
35    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp",
36  ]
37  include_dirs = [
38    "../include",
39    "../../api/include",
40    "${OHOS_PROFILER_DIR}/interfaces/kits",
41    "${OHOS_PROFILER_DIR}/device/base/include",
42  ]
43  cflags = [
44    "-Wno-inconsistent-missing-override",
45    "-Dprivate=public",  #allow test code access private members
46  ]
47  external_deps = [
48    "bounds_checking_function:libsec_shared",
49    "c_utils:utils",
50    "drivers_interface_memorytracker:libmemorytracker_proxy_1.0",
51    "googletest:gtest",
52    "hilog:libhilog_base",
53    "hiview:libucollection_utility",
54    "protobuf:protobuf_lite",
55  ]
56  configs = [ ":module_private_config" ]
57  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
58  part_name = "${OHOS_PROFILER_PART_NAME}"
59  resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml"
60}
61
62ohos_unittest("smaps_stats_ut") {
63  module_out_path = module_output_path
64  sources = [ "unittest/smaps_stats_unittest.cpp" ]
65  deps = [
66    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memdataplugin_source",
67    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp",
68  ]
69  include_dirs = [
70    "../include",
71    "../../api/include",
72    "${OHOS_PROFILER_DIR}/interfaces/kits",
73    "${OHOS_PROFILER_DIR}/device/base/include",
74  ]
75  cflags = [
76    "-Wno-inconsistent-missing-override",
77    "-Dprivate=public",  #allow test code access private members
78  ]
79  external_deps = [
80    "bounds_checking_function:libsec_shared",
81    "c_utils:utils",
82    "drivers_interface_memorytracker:libmemorytracker_proxy_1.0",
83    "googletest:gtest",
84    "hilog:libhilog_base",
85    "hiview:libucollection_utility",
86    "protobuf:protobuf_lite",
87  ]
88  configs = [ ":module_private_config" ]
89  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
90  resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml"
91}
92
93group("unittest") {
94  testonly = true
95  deps = [
96    ":memdataplugin_ut",
97    ":smaps_stats_ut",
98  ]
99}
100