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("//build/test.gni")
14import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni")
15
16module_output_path = "datamgr_service/distributeddatafwk"
17
18###############################################################################
19config("module_dfx_mst_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "../src",
24    "../src/fault",
25    "../src/statistic",
26    "../../include/log",
27    "../../include/autils",
28    "../../include/dfx",
29    "${kv_store_path}/interfaces/inner_api/distributeddata/include",
30    "//commonlibrary/c_utils/base/include",
31    "//utils/system/safwk/native/include",
32    "//third_party/openssl/include/",
33    "//foundation/distributeddatamgr/kv_store/frameworks/common",
34  ]
35}
36
37ohos_unittest("DistributeddataDfxMSTTest") {
38  module_out_path = module_output_path
39
40  sources = [ "./unittest/distributeddata_dfx_mst_test.cpp" ]
41
42  configs = [ ":module_dfx_mst_config" ]
43
44  external_deps = [
45    "c_utils:utils",
46    "hilog:libhilog",
47    "hisysevent:libhisysevent",
48    "hitrace:hitrace_meter",
49    "kv_store:distributeddata_inner",
50  ]
51  ldflags = [ "-Wl,--exclude-libs,ALL" ]
52  deps = [
53    "../../dfx:distributeddata_dfx_static",
54    "//third_party/googletest:gtest_main",
55    "//third_party/openssl:libcrypto_shared",
56  ]
57  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
58}
59
60###############################################################################
61config("module_dfx_config") {
62  visibility = [ ":*" ]
63
64  include_dirs = [
65    "./unittest/fake/hiview/include",
66    "./unittest/fake/hiview",
67    "../src",
68    "../src/fault",
69    "../src/statistic",
70    "../../include/log",
71    "../../include/autils",
72    "../../include/dfx",
73    "//commonlibrary/c_utils/base/include",
74    "//utils/system/safwk/native/include",
75    "//third_party/openssl/include/",
76    "//foundation/distributeddatamgr/kv_store/frameworks/common",
77  ]
78}
79
80ohos_unittest("DistributeddataDfxUTTest") {
81  module_out_path = module_output_path
82
83  sources = [
84    "../src/behaviour/behaviour_reporter_impl.cpp",
85    "../src/fault/communication_fault_impl.cpp",
86    "../src/fault/database_fault_impl.cpp",
87    "../src/fault/fault_reporter.cpp",
88    "../src/fault/runtime_fault_impl.cpp",
89    "../src/fault/service_fault_impl.cpp",
90    "../src/hiview_adapter.cpp",
91    "../src/reporter.cpp",
92    "../src/statistic/api_performance_statistic_impl.cpp",
93    "../src/statistic/database_statistic_impl.cpp",
94    "../src/statistic/statistic_reporter.cpp",
95    "../src/statistic/traffic_statistic_impl.cpp",
96    "../src/statistic/visit_statistic_impl.cpp",
97    "./unittest/distributeddata_dfx_ut_test.cpp",
98    "./unittest/fake/hiview/fake_hiview.cpp",
99  ]
100
101  configs = [ ":module_dfx_config" ]
102
103  external_deps = [
104    "c_utils:utils",
105    "hilog:libhilog",
106    "hisysevent:libhisysevent",
107    "hitrace:hitrace_meter",
108    "kv_store:distributeddata_inner",
109  ]
110  ldflags = [ "-Wl,--exclude-libs,ALL" ]
111  deps = [
112    "//third_party/googletest:gtest_main",
113    "//third_party/openssl:libcrypto_shared",
114  ]
115  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
116}
117
118###############################################################################
119group("unittest") {
120  testonly = true
121  deps = []
122
123  deps += [
124    ":DistributeddataDfxMSTTest",
125    ":DistributeddataDfxUTTest",
126  ]
127}
128###############################################################################
129