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}
21
22config("cflags_config") {
23  cflags = [
24    "-Wno-sign-compare",
25    "-Wno-inconsistent-missing-override",
26    "-Dprivate=public",  #allow test code access private members
27  ]
28}
29
30ohos_unittest("profiler_service_ut") {
31  module_out_path = module_output_path
32  sources = [
33    "../../plugin_service/src/plugin_session.cpp",
34    "../../plugin_service/src/plugin_session_manager.cpp",
35    "unittest/plugin_service_stubs.cpp",
36    "unittest/profiler_capability_manager_test.cpp",
37    "unittest/profiler_data_repeater_test.cpp",
38    "unittest/profiler_service_performance_test.cpp",
39    "unittest/profiler_service_test.cpp",
40    "unittest/trace_file_reader_test.cpp",
41    "unittest/trace_file_writer_test.cpp",
42  ]
43  deps = [
44    "${OHOS_PROFILER_DIR}/protos/services:proto_services_cpp",
45    "${OHOS_PROFILER_DIR}/protos/types/plugins/cpu_data:cpu_data_cpp",
46    "${OHOS_PROFILER_DIR}/protos/types/plugins/diskio_data:diskio_data_cpp",
47    "${OHOS_PROFILER_DIR}/protos/types/plugins/hilog_data:hilog_data_cpp",
48    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp",
49    "${OHOS_PROFILER_DIR}/protos/types/plugins/network_data:network_data_cpp",
50    "${OHOS_PROFILER_DIR}/protos/types/plugins/process_data:process_data_cpp",
51    "../:profiler_service",
52    "../../../base:hiprofiler_base",
53  ]
54  include_dirs = [ "${OHOS_PROFILER_DIR}/interfaces/kits" ]
55  configs = [ ":cflags_config" ]
56  if (use_clang_coverage) {
57    defines = [ "COVERAGE_TEST" ]
58  }
59  external_deps = [
60    "abseil-cpp:absl_sync",
61    "bounds_checking_function:libsec_shared",
62    "googletest:gtest",
63    "grpc:grpc",
64    "grpc:grpcxx",
65    "hilog:libhilog_base",
66    "openssl:libcrypto_shared",
67    "protobuf:protobuf_lite",
68  ]
69  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
70}
71
72group("unittest") {
73  testonly = true
74  deps = [ ":profiler_service_ut" ]
75}
76