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/ohos.gni") 1506f6ba60Sopenharmony_ciimport("//build/test.gni") 1606f6ba60Sopenharmony_ciimport("../../../base/config.gni") 1706f6ba60Sopenharmony_ci 1806f6ba60Sopenharmony_cimodule_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device" 1906f6ba60Sopenharmony_ciconfig("module_private_config") { 2006f6ba60Sopenharmony_ci visibility = [ ":*" ] 2106f6ba60Sopenharmony_ci if (current_toolchain != host_toolchain) { 2206f6ba60Sopenharmony_ci defines = [ "HAVE_HILOG" ] 2306f6ba60Sopenharmony_ci } 2406f6ba60Sopenharmony_ci} 2506f6ba60Sopenharmony_ci 2606f6ba60Sopenharmony_ciohos_executable("ffrt_profiler_test_exe") { 2706f6ba60Sopenharmony_ci output_name = "ffrt_profiler_test_exe" 2806f6ba60Sopenharmony_ci 2906f6ba60Sopenharmony_ci sources = [ "unittest/ffrt_profiler_test_exec.cpp" ] 3006f6ba60Sopenharmony_ci 3106f6ba60Sopenharmony_ci defines = [] 3206f6ba60Sopenharmony_ci external_deps = [] 3306f6ba60Sopenharmony_ci 3406f6ba60Sopenharmony_ci external_deps += [ 3506f6ba60Sopenharmony_ci "bounds_checking_function:libsec_shared", 3606f6ba60Sopenharmony_ci "ffrt:libffrt", 3706f6ba60Sopenharmony_ci "init:libbegetutil", 3806f6ba60Sopenharmony_ci ] 3906f6ba60Sopenharmony_ci 4006f6ba60Sopenharmony_ci if (current_toolchain != host_toolchain) { 4106f6ba60Sopenharmony_ci defines += [ "HAVE_HILOG" ] 4206f6ba60Sopenharmony_ci external_deps += [ "hilog:libhilog_base" ] 4306f6ba60Sopenharmony_ci } 4406f6ba60Sopenharmony_ci 4506f6ba60Sopenharmony_ci install_enable = false 4606f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 4706f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 4806f6ba60Sopenharmony_ci} 4906f6ba60Sopenharmony_ci 5006f6ba60Sopenharmony_ciohos_unittest("ffrt_profiler_ut") { 5106f6ba60Sopenharmony_ci module_out_path = module_output_path 5206f6ba60Sopenharmony_ci 5306f6ba60Sopenharmony_ci include_dirs = [ 5406f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/base/include", 5506f6ba60Sopenharmony_ci "../service/include", 5606f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/services/ipc/include", 5706f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/services/shared_memory/include", 5806f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/interfaces/kits", 5906f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/plugins/api/include", 6006f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/plugins/api/src", 6106f6ba60Sopenharmony_ci ] 6206f6ba60Sopenharmony_ci 6306f6ba60Sopenharmony_ci sources = [ 6406f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/plugins/api/src/buffer_writer.cpp", 6506f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/plugins/api/src/writer_adapter.cpp", 6606f6ba60Sopenharmony_ci "../service/src/ffrt_profiler_common.cpp", 6706f6ba60Sopenharmony_ci "../service/src/ffrt_profiler_handle.cpp", 6806f6ba60Sopenharmony_ci "../service/src/ffrt_profiler_manager.cpp", 6906f6ba60Sopenharmony_ci "../service/src/ffrt_profiler_socket_service.cpp", 7006f6ba60Sopenharmony_ci "unittest/ffrt_profiler_test.cpp", 7106f6ba60Sopenharmony_ci ] 7206f6ba60Sopenharmony_ci 7306f6ba60Sopenharmony_ci public_deps = [ 7406f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base", 7506f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/services/ipc:ipc", 7606f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory", 7706f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/proto_encoder:proto_encoder_source", 7806f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto", 7906f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", 8006f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_cpp", 8106f6ba60Sopenharmony_ci "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_encoder", 8206f6ba60Sopenharmony_ci ] 8306f6ba60Sopenharmony_ci 8406f6ba60Sopenharmony_ci public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 8506f6ba60Sopenharmony_ci 8606f6ba60Sopenharmony_ci cflags = [ 8706f6ba60Sopenharmony_ci "-Wno-inconsistent-missing-override", 8806f6ba60Sopenharmony_ci "-Dprivate=public", #allow test code access private members 8906f6ba60Sopenharmony_ci ] 9006f6ba60Sopenharmony_ci 9106f6ba60Sopenharmony_ci external_deps = [ 9206f6ba60Sopenharmony_ci "googletest:gtest", 9306f6ba60Sopenharmony_ci "hilog:libhilog_base", 9406f6ba60Sopenharmony_ci "init:libbegetutil", 9506f6ba60Sopenharmony_ci "protobuf:protobuf_lite", 9606f6ba60Sopenharmony_ci ] 9706f6ba60Sopenharmony_ci configs = [ ":module_private_config" ] 9806f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 9906f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 10006f6ba60Sopenharmony_ci resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml" 10106f6ba60Sopenharmony_ci} 10206f6ba60Sopenharmony_ci 10306f6ba60Sopenharmony_cigroup("unittest") { 10406f6ba60Sopenharmony_ci testonly = true 10506f6ba60Sopenharmony_ci deps = [ 10606f6ba60Sopenharmony_ci ":ffrt_profiler_test_exe", 10706f6ba60Sopenharmony_ci ":ffrt_profiler_ut", 10806f6ba60Sopenharmony_ci ] 10906f6ba60Sopenharmony_ci} 110