1# Copyright (c) 2021 Huawei Device Co., Ltd. 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/hitrace_ops_test.cpp", 36 "unittest/kernel_symbols_parser_test.cpp", 37 "unittest/paged_mem_pool_test.cpp", 38 "unittest/printk_formats_parser_test.cpp", 39 "unittest/process_utils_test.cpp", 40 "unittest/result_transporter_test.cpp", 41 "unittest/string_utils_test.cpp", 42 "unittest/sub_event_parser_test.cpp", 43 "unittest/trace_ops_test.cpp", 44 ] 45 deps = [ 46 "${OHOS_PROFILER_DIR}/device/plugins/ftrace_plugin:ftrace_plugin_source", 47 "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_cpp", 48 "//third_party/bounds_checking_function:libsec_static", 49 "//third_party/googletest:gtest_main", 50 ] 51 include_dirs = [ 52 "../include", 53 "../../../memory_plugin/include", 54 "${OHOS_PROFILER_DIR}/interfaces/kits", 55 "${OHOS_PROFILER_DIR}/device/base/include", 56 "//third_party/googletest/googletest/include/gtest", 57 "//third_party/bounds_checking_function/include", 58 "//commonlibrary/c_utils/base/include", 59 ] 60 cflags = [ 61 "-Wno-inconsistent-missing-override", 62 "-Dprivate=public", #allow test code access private members 63 ] 64 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 65 configs = [ ":module_private_config" ] 66 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 67 part_name = "${OHOS_PROFILER_PART_NAME}" 68} 69 70ohos_executable("busy_test") { 71 sources = [ "app/busy_workers.cpp" ] 72 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 73 install_enable = false 74 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 75 part_name = "${OHOS_PROFILER_PART_NAME}" 76} 77 78ohos_executable("regex_test") { 79 sources = [ "app/regex_test.cpp" ] 80 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 81 install_enable = false 82 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 83 part_name = "${OHOS_PROFILER_PART_NAME}" 84} 85 86ohos_executable("get_tzinfo") { 87 sources = [ "app/get_tzinfo.cpp" ] 88 public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ] 89 install_enable = false 90 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 91 part_name = "${OHOS_PROFILER_PART_NAME}" 92} 93 94group("unittest") { 95 testonly = true 96 deps = [ ":ftrace_plugin_ut" ] 97} 98