• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) Huawei Technologies Co., Ltd. 2023. 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.
13import("//build/test.gni")
14import("../../../base/config.gni")
15
16module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device"
17
18config("module_private_config") {
19  visibility = [ ":*" ]
20  defines = [
21    "is_ohos=1",
22    "CONFIG_NO_HILOG",
23    "target_cpu_${target_cpu}",
24  ]
25
26  if (current_toolchain != host_toolchain) {
27    defines += [ "HAVE_HILOG" ]
28  }
29}
30
31ohos_unittest("xpowerplugin_ut") {
32  module_out_path = module_output_path
33  sources = [
34    "../src/power_message_queue.cpp",
35    "../src/xpower_module.cpp",
36    "../src/xpower_plugin.cpp",
37    "unittest/xpower_plugin_unittest.cpp",
38  ]
39  deps = [
40    "${OHOS_PROFILER_DIR}/protos/types/plugins/xpower_data:xpower_data_cpp",
41    "../../../base:hiprofiler_base",
42    "//third_party/bounds_checking_function:libsec_static",
43  ]
44
45  include_dirs = [
46    "../include",
47    "../../api/include",
48    "${OHOS_PROFILER_DIR}/interfaces/kits",
49    "${OHOS_PROFILER_DIR}/device/base/include",
50    "//third_party/googletest/googletest/include/gtest",
51    "//third_party/bounds_checking_function/include",
52  ]
53
54  cflags = [
55    "-Wno-inconsistent-missing-override",
56    "-Dprivate=public",  #allow test code access private members
57    "-Dprotected=public",  #allow test code access private members
58  ]
59  external_deps = [ "hilog:libhilog" ]
60  configs = [ ":module_private_config" ]
61  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
62  part_name = "${OHOS_PROFILER_PART_NAME}"
63}
64group("unittest") {
65  testonly = true
66  deps = [ ":xpowerplugin_ut" ]
67}
68