106f6ba60Sopenharmony_ci# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
206f6ba60Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
306f6ba60Sopenharmony_ci# you may not use this file except in compliance with the License.
406f6ba60Sopenharmony_ci# You may obtain a copy of the License at
506f6ba60Sopenharmony_ci#
606f6ba60Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
706f6ba60Sopenharmony_ci#
806f6ba60Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
906f6ba60Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1006f6ba60Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1106f6ba60Sopenharmony_ci# See the License for the specific language governing permissions and
1206f6ba60Sopenharmony_ci# limitations under the License.
1306f6ba60Sopenharmony_ci
1406f6ba60Sopenharmony_ciimport("//build/test.gni")
1506f6ba60Sopenharmony_ciimport("../../../base/config.gni")
1606f6ba60Sopenharmony_ci
1706f6ba60Sopenharmony_cimodule_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device"
1806f6ba60Sopenharmony_ciconfig("module_private_config") {
1906f6ba60Sopenharmony_ci  visibility = [ ":*" ]
2006f6ba60Sopenharmony_ci}
2106f6ba60Sopenharmony_ci
2206f6ba60Sopenharmony_ciconfig("cflags_config") {
2306f6ba60Sopenharmony_ci  cflags = [
2406f6ba60Sopenharmony_ci    "-Wno-sign-compare",
2506f6ba60Sopenharmony_ci    "-Wno-inconsistent-missing-override",
2606f6ba60Sopenharmony_ci    "-Dprivate=public",  #allow test code access private members
2706f6ba60Sopenharmony_ci  ]
2806f6ba60Sopenharmony_ci}
2906f6ba60Sopenharmony_ci
3006f6ba60Sopenharmony_ciohos_unittest("profiler_service_ut") {
3106f6ba60Sopenharmony_ci  module_out_path = module_output_path
3206f6ba60Sopenharmony_ci  sources = [
3306f6ba60Sopenharmony_ci    "../../plugin_service/src/plugin_session.cpp",
3406f6ba60Sopenharmony_ci    "../../plugin_service/src/plugin_session_manager.cpp",
3506f6ba60Sopenharmony_ci    "unittest/plugin_service_stubs.cpp",
3606f6ba60Sopenharmony_ci    "unittest/profiler_capability_manager_test.cpp",
3706f6ba60Sopenharmony_ci    "unittest/profiler_data_repeater_test.cpp",
3806f6ba60Sopenharmony_ci    "unittest/profiler_service_performance_test.cpp",
3906f6ba60Sopenharmony_ci    "unittest/profiler_service_test.cpp",
4006f6ba60Sopenharmony_ci    "unittest/trace_file_reader_test.cpp",
4106f6ba60Sopenharmony_ci    "unittest/trace_file_writer_test.cpp",
4206f6ba60Sopenharmony_ci  ]
4306f6ba60Sopenharmony_ci  deps = [
4406f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/services:proto_services_cpp",
4506f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/cpu_data:cpu_data_cpp",
4606f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/diskio_data:diskio_data_cpp",
4706f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/hilog_data:hilog_data_cpp",
4806f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp",
4906f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/network_data:network_data_cpp",
5006f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/process_data:process_data_cpp",
5106f6ba60Sopenharmony_ci    "../:profiler_service",
5206f6ba60Sopenharmony_ci    "../../../base:hiprofiler_base",
5306f6ba60Sopenharmony_ci  ]
5406f6ba60Sopenharmony_ci  include_dirs = [ "${OHOS_PROFILER_DIR}/interfaces/kits" ]
5506f6ba60Sopenharmony_ci  configs = [ ":cflags_config" ]
5606f6ba60Sopenharmony_ci  if (use_clang_coverage) {
5706f6ba60Sopenharmony_ci    defines = [ "COVERAGE_TEST" ]
5806f6ba60Sopenharmony_ci  }
5906f6ba60Sopenharmony_ci  external_deps = [
6006f6ba60Sopenharmony_ci    "abseil-cpp:absl_sync",
6106f6ba60Sopenharmony_ci    "bounds_checking_function:libsec_shared",
6206f6ba60Sopenharmony_ci    "googletest:gtest",
6306f6ba60Sopenharmony_ci    "grpc:grpc",
6406f6ba60Sopenharmony_ci    "grpc:grpcxx",
6506f6ba60Sopenharmony_ci    "hilog:libhilog_base",
6606f6ba60Sopenharmony_ci    "openssl:libcrypto_shared",
6706f6ba60Sopenharmony_ci    "protobuf:protobuf_lite",
6806f6ba60Sopenharmony_ci  ]
6906f6ba60Sopenharmony_ci  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
7006f6ba60Sopenharmony_ci}
7106f6ba60Sopenharmony_ci
7206f6ba60Sopenharmony_cigroup("unittest") {
7306f6ba60Sopenharmony_ci  testonly = true
7406f6ba60Sopenharmony_ci  deps = [ ":profiler_service_ut" ]
7506f6ba60Sopenharmony_ci}
76