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("../../../device/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("plugin_module_api_ut") {
26  module_out_path = module_output_path
27  deps = [
28    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base",
29    "${OHOS_PROFILER_DIR}/proto_encoder:proto_encoder_source",
30    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp",
31    "${OHOS_PROFILER_DIR}/protos/types/plugins/sample_data:sample_data_cpp",
32    "${OHOS_PROFILER_DIR}/protos/types/plugins/stream_data:stream_data_cpp",
33  ]
34  include_dirs = [
35    "../",
36    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/include",
37    "${OHOS_PROFILER_DIR}/device/plugins/sample_plugin/include",
38    "${OHOS_PROFILER_DIR}/device/plugins/stream_plugin/include",
39    "${OHOS_PROFILER_DIR}/device/plugins/api/include",
40    "${OHOS_PROFILER_DIR}/device/plugins/api/src",
41    "${OHOS_PROFILER_DIR}/device/base/include",
42  ]
43  sources = [
44    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/src/buffer_splitter.cpp",
45    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/src/memory_data_plugin.cpp",
46    "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin/src/smaps_stats.cpp",
47    "${OHOS_PROFILER_DIR}/device/plugins/sample_plugin/src/sample_plugin.cpp",
48    "${OHOS_PROFILER_DIR}/device/plugins/stream_plugin/src/stream_plugin.cpp",
49    "unittest/plugin_module_api_test.cpp",
50  ]
51  cflags = [
52    "-pthread",
53    "-Wno-inconsistent-missing-override",
54    "-Dprivate=public",  #allow test code access private members
55  ]
56  external_deps = [
57    "bounds_checking_function:libsec_shared",
58    "c_utils:utils",
59    "drivers_interface_memorytracker:libmemorytracker_proxy_1.0",
60    "googletest:gtest",
61    "hidumper:lib_dump_usage",
62    "hilog:libhilog_base",
63    "hiview:libucollection_graphic",
64    "protobuf:protobuf_lite",
65  ]
66  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
67  part_name = "${OHOS_PROFILER_PART_NAME}"
68  configs = [ ":module_private_config" ]
69}
70
71group("unittest") {
72  testonly = true
73  deps = [ ":plugin_module_api_ut" ]
74}
75