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") 16import("../ftrace.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_unittest("ftrace_plugin_ut") { 27 module_out_path = module_output_path 28 sources = [ 29 "unittest/file_utils_test.cpp", 30 "unittest/flow_controller_test.cpp", 31 "unittest/ftrace_data_reader_test.cpp", 32 "unittest/ftrace_field_parser_test.cpp", 33 "unittest/ftrace_fs_ops_test.cpp", 34 "unittest/ftrace_parser_test.cpp", 35 "unittest/kernel_symbols_parser_test.cpp", 36 "unittest/paged_mem_pool_test.cpp", 37 "unittest/printk_formats_parser_test.cpp", 38 "unittest/result_transporter_test.cpp", 39 "unittest/string_utils_test.cpp", 40 "unittest/sub_event_parser_test.cpp", 41 ] 42 deps = [ 43 "${OHOS_PROFILER_DIR}/device/plugins/ftrace_plugin:ftrace_plugin_source", 44 "${OHOS_PROFILER_DIR}/proto_encoder:proto_encoder_source", 45 "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_cpp", 46 "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_encoder", 47 ] 48 include_dirs = [ 49 "../include", 50 "../../../memory_plugin/include", 51 "${OHOS_PROFILER_DIR}/interfaces/kits", 52 "${OHOS_PROFILER_DIR}/device/base/include", 53 "//commonlibrary/c_utils/base/include", 54 ] 55 cflags = [ 56 "-Wno-inconsistent-missing-override", 57 "-Dprivate=public", #allow test code access private members 58 ] 59 external_deps = [ 60 "bounds_checking_function:libsec_shared", 61 "googletest:gtest", 62 "hilog:libhilog_base", 63 "hiview:libucollection_client", 64 "protobuf:protobuf_lite", 65 ] 66 configs = [ ":module_private_config" ] 67 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 68 part_name = "${OHOS_PROFILER_PART_NAME}" 69 resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml" 70} 71 72ohos_executable("busy_test") { 73 sources = [ "app/busy_workers.cpp" ] 74 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 75 install_enable = false 76 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 77 part_name = "${OHOS_PROFILER_PART_NAME}" 78} 79 80ohos_executable("regex_test") { 81 sources = [ "app/regex_test.cpp" ] 82 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 83 install_enable = false 84 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 85 part_name = "${OHOS_PROFILER_PART_NAME}" 86} 87 88ohos_executable("get_tzinfo") { 89 sources = [ "app/get_tzinfo.cpp" ] 90 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 91 install_enable = false 92 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 93 part_name = "${OHOS_PROFILER_PART_NAME}" 94} 95 96group("unittest") { 97 testonly = true 98 deps = [ ":ftrace_plugin_ut" ] 99} 100