• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/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}/proto_encoder:proto_encoder_source",
48    "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_cpp",
49    "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_data_encoder",
50  ]
51  include_dirs = [
52    "../include",
53    "../../../memory_plugin/include",
54    "${OHOS_PROFILER_DIR}/interfaces/kits",
55    "${OHOS_PROFILER_DIR}/device/base/include",
56    "//commonlibrary/c_utils/base/include",
57  ]
58  cflags = [
59    "-Wno-inconsistent-missing-override",
60    "-Dprivate=public",  #allow test code access private members
61  ]
62  external_deps = [
63    "bounds_checking_function:libsec_shared",
64    "googletest:gtest",
65    "hilog:libhilog",
66    "hiview:libucollection_client",
67    "protobuf:protobuf_lite",
68  ]
69  configs = [ ":module_private_config" ]
70  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
71  part_name = "${OHOS_PROFILER_PART_NAME}"
72  resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml"
73}
74
75ohos_executable("busy_test") {
76  sources = [ "app/busy_workers.cpp" ]
77  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
78  install_enable = false
79  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
80  part_name = "${OHOS_PROFILER_PART_NAME}"
81}
82
83ohos_executable("regex_test") {
84  sources = [ "app/regex_test.cpp" ]
85  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
86  install_enable = false
87  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
88  part_name = "${OHOS_PROFILER_PART_NAME}"
89}
90
91ohos_executable("get_tzinfo") {
92  sources = [ "app/get_tzinfo.cpp" ]
93  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
94  install_enable = false
95  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
96  part_name = "${OHOS_PROFILER_PART_NAME}"
97}
98
99group("unittest") {
100  testonly = true
101  deps = [ ":ftrace_plugin_ut" ]
102}
103