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/ohos.gni") 15import("//build/test.gni") 16import("../../../base/config.gni") 17 18module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device" 19config("module_private_config") { 20 visibility = [ ":*" ] 21 if (current_toolchain != host_toolchain) { 22 defines = [ "HAVE_HILOG" ] 23 } 24} 25 26ohos_executable("ffrt_profiler_test_exe") { 27 output_name = "ffrt_profiler_test_exe" 28 29 sources = [ "unittest/ffrt_profiler_test_exec.cpp" ] 30 31 defines = [] 32 external_deps = [] 33 34 external_deps += [ 35 "bounds_checking_function:libsec_shared", 36 "ffrt:libffrt", 37 "init:libbegetutil", 38 ] 39 40 if (current_toolchain != host_toolchain) { 41 defines += [ "HAVE_HILOG" ] 42 external_deps += [ "hilog:libhilog_base" ] 43 } 44 45 install_enable = false 46 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 47 part_name = "${OHOS_PROFILER_PART_NAME}" 48} 49 50ohos_unittest("ffrt_profiler_ut") { 51 module_out_path = module_output_path 52 53 include_dirs = [ 54 "${OHOS_PROFILER_DIR}/device/base/include", 55 "../service/include", 56 "${OHOS_PROFILER_DIR}/device/services/ipc/include", 57 "${OHOS_PROFILER_DIR}/device/services/shared_memory/include", 58 "${OHOS_PROFILER_DIR}/interfaces/kits", 59 "${OHOS_PROFILER_DIR}/device/plugins/api/include", 60 "${OHOS_PROFILER_DIR}/device/plugins/api/src", 61 ] 62 63 sources = [ 64 "${OHOS_PROFILER_DIR}/device/plugins/api/src/buffer_writer.cpp", 65 "${OHOS_PROFILER_DIR}/device/plugins/api/src/writer_adapter.cpp", 66 "../service/src/ffrt_profiler_common.cpp", 67 "../service/src/ffrt_profiler_handle.cpp", 68 "../service/src/ffrt_profiler_manager.cpp", 69 "../service/src/ffrt_profiler_socket_service.cpp", 70 "unittest/ffrt_profiler_test.cpp", 71 ] 72 73 public_deps = [ 74 "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base", 75 "${OHOS_PROFILER_DIR}/device/services/ipc:ipc", 76 "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory", 77 "${OHOS_PROFILER_DIR}/proto_encoder:proto_encoder_source", 78 "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto", 79 "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 80 "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_cpp", 81 "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_encoder", 82 ] 83 84 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 85 86 cflags = [ 87 "-Wno-inconsistent-missing-override", 88 "-Dprivate=public", #allow test code access private members 89 ] 90 91 external_deps = [ 92 "googletest:gtest", 93 "hilog:libhilog_base", 94 "init:libbegetutil", 95 "protobuf:protobuf_lite", 96 ] 97 configs = [ ":module_private_config" ] 98 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 99 part_name = "${OHOS_PROFILER_PART_NAME}" 100 resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml" 101} 102 103group("unittest") { 104 testonly = true 105 deps = [ 106 ":ffrt_profiler_test_exe", 107 ":ffrt_profiler_ut", 108 ] 109} 110