• 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.
13import("//base/hiviewdfx/hiview/hiview.gni")
14import("//build/ohos.gni")
15import("//build/test.gni")
16
17module_output_path = hiview_module
18
19group("moduletest") {
20  testonly = true
21}
22
23ohos_unittest("HiviewPlatformModuleTest") {
24  module_out_path = module_output_path
25
26  include_dirs = [ "moduletest/common" ]
27
28  sources = [ "moduletest/common/hiview_plugin_platform_module_test.cpp" ]
29
30  deps = [ "$hiview_base:hiviewbase_static_lib_for_tdd" ]
31
32  external_deps = [
33    "googletest:gtest_main",
34    "hilog:libhilog",
35  ]
36}
37
38config("HolisticPlatformTest_config") {
39  include_dirs = [
40    "../",
41    "$hiview_test/plugins/examples_bundle/bundle_event_source_example",
42    "$hiview_test/plugins/examples/event_source_example",
43  ]
44
45  cflags_cc = [
46    "-D__UNITTEST__",
47    "-D__HIVIEW_OHOS__",
48    "-DUSE_POLL",
49  ]
50}
51
52ohos_unittest("HolisticPlatformTest") {
53  testonly = true
54  module_out_path = module_output_path
55  configs = [ ":HolisticPlatformTest_config" ]
56
57  sources = [ "unittest/common/holistic_platform_test.cpp" ]
58
59  deps = [
60    "$hiview_base:hiviewbase_static_lib_for_tdd",
61    "$hiview_core:hiview_core_for_test",
62    "$hiview_root/test/plugins/examples/dynamic_load_plugin_example:dynamicloadpluginexample",
63    "$hiview_root/test/plugins/examples/event_processor_example1:event_processor_example1",
64    "$hiview_root/test/plugins/examples/event_processor_example2:event_processor_example2",
65    "$hiview_root/test/plugins/examples/event_processor_example3:event_processor_example3",
66    "$hiview_root/test/plugins/examples/event_processor_example4:event_processor_example4",
67    "$hiview_root/test/plugins/examples/event_processor_example5:event_processor_example5",
68    "$hiview_root/test/plugins/examples/event_source_example:event_source_example",
69    "$hiview_test/plugins/examples_bundle:bundleplugintest",
70  ]
71
72  external_deps = [
73    "c_utils:utils",
74    "ffrt:libffrt",
75    "googletest:gtest_main",
76    "hilog:libhilog",
77  ]
78
79  resource_config_file = "$hiview_test/resource/ohos_test.xml"
80}
81
82ohos_unittest("ReportXPowerEventTest") {
83  module_out_path = "hiview/OH-Xpower"
84  configs = []
85
86  sources = [ "unittest/xpower_event/xpower_event_test.cpp" ]
87
88  deps = [ "$hiview_root/interfaces/inner_api/xpower_event:libxpower_event" ]
89
90  external_deps = [
91    "googletest:gtest_main",
92    "hilog:libhilog",
93    "init:libbegetutil",
94  ]
95}
96
97if (!defined(ohos_lite)) {
98  import("//build/test.gni")
99
100  ohos_unittest("ReportXPowerJsEventTest") {
101    module_out_path = "hiview/OH-Xpower"
102    cflags = [ "-g3" ]
103    defines = [ "NAPI_TEST" ]
104
105    sources = [ "unittest/xpower_event/xpower_jsevent_test.cpp" ]
106    deps =
107        [ "$hiview_root/interfaces/inner_api/xpower_event:libxpower_event_js" ]
108    external_deps = [
109      "bounds_checking_function:libsec_shared",
110      "c_utils:utils",
111      "ets_runtime:libark_jsruntime",
112      "init:libbegetutil",
113      "napi:ace_napi",
114    ]
115
116    external_deps += [ "hilog:libhilog" ]
117  }
118}
119
120group("unittest") {
121  testonly = true
122  deps = [
123    ":HiviewPlatformModuleTest",
124    ":HolisticPlatformTest",
125    ":ReportXPowerEventTest",
126    ":ReportXPowerJsEventTest",
127    "unittest/unified_collection/client:UCollectionClientUnitTest",
128    "unittest/unified_collection/utility:UCollectionUtilityUnitTest",
129  ]
130
131  if (hiview_unified_collector_trace_enable) {
132    deps += [ "unittest/unified_collection/utility:UCollectionTraceUnitTest" ]
133  }
134
135  deps += [ "unittest/unified_collection/utils:UCollectionUtilsUnitTest" ]
136}
137