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