• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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")
16
17module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device"
18config("module_private_config") {
19  visibility = [ ":*" ]
20  if (current_toolchain != host_toolchain) {
21    defines = [ "HAVE_HILOG" ]
22  }
23}
24
25ohos_unittest("ftrace_plugin_ut") {
26  module_out_path = module_output_path
27  sources = [
28    "unittest/bytrace_ops_test.cpp",
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/process_utils_test.cpp",
39    "unittest/result_transporter_test.cpp",
40    "unittest/string_utils_test.cpp",
41    "unittest/sub_event_parser_test.cpp",
42    "unittest/trace_ops_test.cpp",
43  ]
44  deps = [
45    "${OHOS_PROFILER_DIR}/device/plugins/ftrace_plugin:ftrace_plugin",
46    "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data:ftrace_data_cpp",
47    "//third_party/googletest:gtest_main",
48    "//utils/native/base:utilsecurec",
49  ]
50  include_dirs = [
51    "../include",
52    "../../../memory_plugin/include",
53    "${OHOS_PROFILER_DIR}/interfaces/kits",
54    "${OHOS_PROFILER_DIR}/device/base/include",
55    "//third_party/googletest/googletest/include/gtest",
56    "//utils/native/base/include",
57  ]
58  cflags = [
59    "-Wno-inconsistent-missing-override",
60    "-Dprivate=public",  #allow test code access private members
61  ]
62  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
63  configs = [ ":module_private_config" ]
64  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
65  part_name = "${OHOS_PROFILER_PART_NAME}"
66}
67
68ohos_executable("busy_test") {
69  sources = [ "app/busy_workers.cpp" ]
70  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
71  install_enable = false
72  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
73  part_name = "${OHOS_PROFILER_PART_NAME}"
74}
75
76ohos_executable("regex_test") {
77  sources = [ "app/regex_test.cpp" ]
78  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
79  install_enable = false
80  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
81  part_name = "${OHOS_PROFILER_PART_NAME}"
82}
83
84ohos_executable("get_tzinfo") {
85  sources = [ "app/get_tzinfo.cpp" ]
86  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
87  install_enable = false
88  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
89  part_name = "${OHOS_PROFILER_PART_NAME}"
90}
91
92group("unittest") {
93  testonly = true
94  deps = [ ":ftrace_plugin_ut" ]
95}
96