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