1# Copyright (c) 2022 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/ohos.gni")
15import("//build/test.gni")
16
17config("dslm_cmoker") {
18  include_dirs = [ "cmocker" ]
19}
20
21group("dslm_test") {
22  testonly = true
23  deps = []
24
25  if (os_level == "standard") {
26    deps += [ ":DslmUnitTest" ]
27  }
28}
29
30if (os_level == "standard") {
31  # test unittest
32  ohos_unittest("DslmUnitTest") {
33    sanitize = {
34      integer_overflow = true
35      ubsan = true
36      boundary_sanitize = true
37      cfi = true
38      cfi_cross_dso = true
39      blocklist = "../../cfi_blocklist.txt"
40    }
41    branch_protector_ret = "pac_ret"
42
43    install_enable = true
44    testonly = true
45    part_name = "device_security_level"
46    subsystem_name = "security"
47    module_out_path = "${part_name}/${target_name}"
48
49    sources = [
50      "../../baselib/msglib/src/utils/messenger_utils.c",
51      "../../baselib/utils/src/utils_work_queue.c",
52      "../../oem_property/ohos/standard/dslm_ohos_credential.c",
53      "../../services/dfx/dslm_bigdata.cpp",
54      "../../services/dfx/dslm_hidumper.c",
55      "../../services/dfx/dslm_hitrace.cpp",
56      "../../services/sa/common/dslm_rpc_process.c",
57      "dslm_baselib_utils_test.cpp",
58      "dslm_memory_mock.cpp",
59      "dslm_msg_interface_mock.cpp",
60      "dslm_oem_property_test.cpp",
61      "dslm_request_callback_mock.cpp",
62      "dslm_rpc_process_test.cpp",
63      "dslm_test.cpp",
64    ]
65
66    include_dirs = [
67      "../../baselib/msglib/include",
68      "../../baselib/msglib/src/common",
69      "../../baselib/msglib/src/standard",
70      "../../common/include",
71      "../../interfaces/inner_api/include",
72      "../../interfaces/inner_api/src/standard",
73      "../../oem_property/common",
74      "../../oem_property/include",
75      "../../oem_property/ohos/common",
76      "../../oem_property/ohos/standard/impl",
77      "../../services/include",
78      "../../services/dslm",
79      "../../services/sa/common",
80    ]
81
82    configs = [ "../../common:common_configs" ]
83
84    configs += [ ":dslm_cmoker" ]
85
86    deps = [
87      "../../baselib/utils:utils_static",
88      "../../oem_property/ohos/standard:dslm_ohos_cred_obj",
89      "../../services/common:service_common_obj",
90      "../../services/dslm:service_dslm_test_obj",
91      "../../services/msg:service_msg_obj",
92      "//third_party/googletest:gmock",
93    ]
94
95    external_deps = [
96      "access_token:libnativetoken",
97      "access_token:libtoken_setproc",
98      "c_utils:utils",
99      "device_security_level:dslm_sdk",
100      "hilog:libhilog",
101      "hisysevent:libhisysevent",
102      "hitrace:hitrace_meter",
103      "huks:libhukssdk",
104    ]
105  }
106}
107