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("hiprofiler_cmd_ut") {
26  module_out_path = module_output_path
27  sources = [
28    "../src/parse_plugin_config.cpp",
29    "unittest/hiprofiler_cmd_test.cpp",
30    "unittest/parse_plugin_config_test.cpp",
31  ]
32  deps = [
33    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base",
34    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_proto",
35    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_type_source",
36    "${OHOS_PROFILER_DIR}/protos/types/plugins/cpu_data:cpu_plugin_config_cpp_standard",
37    "${OHOS_PROFILER_DIR}/protos/types/plugins/diskio_data:diskio_plugin_config_cpp_standard",
38    "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_cpp_standard",
39    "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/default:ftrace_plugin_config_cpp_standard",
40    "${OHOS_PROFILER_DIR}/protos/types/plugins/gpu_data:gpu_plugin_config_cpp_standard",
41    "${OHOS_PROFILER_DIR}/protos/types/plugins/hidump_data:hidump_plugin_config_cpp_standard",
42    "${OHOS_PROFILER_DIR}/protos/types/plugins/hiebpf_data:hiebpf_data_cpp_standard",
43    "${OHOS_PROFILER_DIR}/protos/types/plugins/hilog_data:hilog_plugin_config_cpp_standard",
44    "${OHOS_PROFILER_DIR}/protos/types/plugins/hiperf_data:hiperf_data_cpp_standard",
45    "${OHOS_PROFILER_DIR}/protos/types/plugins/hisysevent_data:hisysevent_plugin_config_cpp_standard",
46    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_plugin_config_cpp_standard",
47    "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_plugin_config_cpp_standard",
48    "${OHOS_PROFILER_DIR}/protos/types/plugins/network_data:network_plugin_config_cpp_standard",
49    "${OHOS_PROFILER_DIR}/protos/types/plugins/network_profiler:network_profiler_cpp_standard",
50    "${OHOS_PROFILER_DIR}/protos/types/plugins/process_data:process_plugin_config_cpp_standard",
51    "${OHOS_PROFILER_DIR}/protos/types/plugins/xpower_data:xpower_plugin_config_cpp_standard",
52  ]
53  include_dirs = [
54    "../include",
55    "${OHOS_PROFILER_DIR}/device/base/include",
56  ]
57  cflags = [
58    "-Wno-inconsistent-missing-override",
59    "-Dprivate=public",  #allow test code access private members
60  ]
61  external_deps = [
62    "abseil-cpp:absl_sync",
63    "bounds_checking_function:libsec_shared",
64    "googletest:gtest",
65    "grpc:grpc",
66    "grpc:grpcxx",
67    "hilog:libhilog_base",
68    "openssl:libcrypto_shared",
69    "protobuf:protobuf_lite",
70  ]
71  configs = [ ":module_private_config" ]
72  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
73  part_name = "${OHOS_PROFILER_PART_NAME}"
74  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
75}
76
77group("unittest") {
78  testonly = true
79  deps = [ ":hiprofiler_cmd_ut" ]
80}
81