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("shared_memory_ut") {
26  module_out_path = module_output_path
27  sources = [
28    "unittest/shared_memory_allocator_test.cpp",
29    "unittest/shared_memory_block_test.cpp",
30  ]
31  include_dirs = [
32    "${OHOS_PROFILER_DIR}/device/services/ipc/include",
33    "${OHOS_PROFILER_DIR}/interfaces/kits",
34  ]
35  configs = [ ":module_private_config" ]
36  deps = [
37    "${OHOS_PROFILER_DIR}/device/services/ipc:ipc",
38    "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto",
39    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source",
40    "../:shared_memory_source",
41  ]
42  cflags = [
43    "-Wno-inconsistent-missing-override",
44    "-Dprivate=public",  #allow test code access private members
45    "-Dprotected=public",  #allow test code access private members
46  ]
47  external_deps = [
48    "bounds_checking_function:libsec_shared",
49    "googletest:gtest",
50    "hilog:libhilog_base",
51    "protobuf:protobuf_lite",
52  ]
53  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
54  part_name = "${OHOS_PROFILER_PART_NAME}"
55}
56
57group("unittest") {
58  testonly = true
59  deps = [ ":shared_memory_ut" ]
60}
61