1# Copyright (C) 2022-2024 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
17module_output_path = "pin_auth/PinAuth_UT_test"
18
19ohos_unittest("PinAuth_UT_test") {
20  sanitize = {
21    integer_overflow = true
22    ubsan = true
23    boundary_sanitize = true
24    cfi = true
25    cfi_cross_dso = true
26    debug = false
27    blocklist = "../../cfi_blocklist.txt"
28  }
29  branch_protector_ret = "pac_ret"
30  module_out_path = module_output_path
31
32  cflags = [
33    "-Dprivate=public",
34    "-Dprotected=public",
35  ]
36
37  sources = [
38    "src/framework_client_pinauth_register_impl_test.cpp",
39    "src/framework_scrypt_scrypt_test.cpp",
40    "src/inputer_data_impl_test.cpp",
41    "src/inputer_get_data_proxy_test.cpp",
42    "src/inputer_get_data_service_test.cpp",
43    "src/inputer_get_data_stub_test.cpp",
44    "src/inputer_set_data_proxy_test.cpp",
45    "src/inputer_set_data_stub_test.cpp",
46    "src/pin_auth_all_in_one_hdi_unit_test.cpp",
47    "src/pin_auth_collector_hdi_unit_test.cpp",
48    "src/pin_auth_driver_hdi_unit_test.cpp",
49    "src/pin_auth_executor_callback_hdi_unit_test.cpp",
50    "src/pin_auth_proxy_test.cpp",
51    "src/pin_auth_register_test.cpp",
52    "src/pin_auth_service_test.cpp",
53    "src/pin_auth_stub_test.cpp",
54    "src/pin_auth_verifier_hdi_unit_test.cpp",
55    "src/services_inputer_data_impl_test.cpp",
56    "src/services_pin_auth_manager_test.cpp",
57  ]
58
59  include_dirs = [
60    "inc",
61    "mocks",
62  ]
63
64  deps = [
65    "../../frameworks:pinauth_framework_source_set",
66    "../../frameworks:pinauth_ipc",
67    "../../services:pinauthservice_source_set",
68    "//third_party/googletest:gmock",
69    "//third_party/openssl:libcrypto_shared",
70  ]
71
72  external_deps = [
73    "access_token:libaccesstoken_sdk",
74    "access_token:libnativetoken",
75    "access_token:libtoken_setproc",
76    "c_utils:utils",
77    "drivers_interface_pin_auth:libpin_auth_proxy_2.1",
78    "hilog:libhilog",
79    "ipc:ipc_single",
80    "safwk:system_ability_fwk",
81    "samgr:samgr_proxy",
82    "user_auth_framework:userauth_client",
83    "user_auth_framework:userauth_executors",
84  ]
85
86  remove_configs = [ "//build/config/compiler:no_exceptions" ]
87
88  configs = [
89    "../../frameworks:pinauth_config",
90    "../../common:iam_log_config",
91    "../../frameworks/:pinauth_ipc_config",
92    "../../common:iam_utils_config",
93  ]
94
95  subsystem_name = "useriam"
96  part_name = "pin_auth"
97}
98
99ohos_unittest("PinAuth_Service_test") {
100  sanitize = {
101    integer_overflow = true
102    ubsan = true
103    boundary_sanitize = true
104    cfi = true
105    cfi_cross_dso = true
106    debug = false
107    blocklist = "../../cfi_blocklist.txt"
108  }
109  branch_protector_ret = "pac_ret"
110  module_out_path = module_output_path
111
112  sources = [ "src/pinauth_test.cpp" ]
113
114  include_dirs = [
115    "inc",
116    "../../interfaces/inner_api",
117  ]
118
119  deps = [ "../../services:pinauthservice" ]
120
121  external_deps = [
122    "c_utils:utils",
123    "hilog:libhilog",
124    "ipc:ipc_single",
125    "pin_auth:pinauth_framework",
126    "safwk:system_ability_fwk",
127  ]
128
129  remove_configs = [ "//build/config/compiler:no_exceptions" ]
130
131  configs = [
132    "../../common:iam_log_config",
133    "../../frameworks/:pinauth_ipc_config",
134    "../../common:iam_utils_config",
135  ]
136
137  subsystem_name = "useriam"
138  part_name = "pin_auth"
139}
140