1# Copyright (c) 2022-2023 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/test.gni")
15import("../cert_manager.gni")
16
17module_output_path = "cert_manager_standard/cert_manager_standard_test"
18
19ohos_unittest("cm_sdk_test") {
20  module_out_path = module_output_path
21  sources = [
22    "unittest/src/cm_abort_test.cpp",
23    "unittest/src/cm_app_cert_test.cpp",
24    "unittest/src/cm_finish_test.cpp",
25    "unittest/src/cm_get_auth_list_test.cpp",
26    "unittest/src/cm_get_certinfo_test.cpp",
27    "unittest/src/cm_get_certlist_test.cpp",
28    "unittest/src/cm_grant_test.cpp",
29    "unittest/src/cm_init_test.cpp",
30    "unittest/src/cm_is_authed_test.cpp",
31    "unittest/src/cm_remove_grant_test.cpp",
32    "unittest/src/cm_set_status_test.cpp",
33    "unittest/src/cm_sys_app_cert_test.cpp",
34    "unittest/src/cm_test_common.cpp",
35    "unittest/src/cm_update_test.cpp",
36    "unittest/src/cm_user_cert_test.cpp",
37  ]
38
39  include_dirs = [ "unittest/include" ]
40  cflags_cc = [
41    "-Wall",
42    "-Werror",
43  ]
44  cflags = cflags_cc
45  branch_protector_ret = "pac_ret"
46  sanitize = {
47    cfi = true
48    cfi_cross_dso = true
49    boundary_sanitize = true
50    debug = false
51    integer_overflow = true
52    ubsan = true
53  }
54
55  deps = [
56    "../frameworks/cert_manager_standard/main:cert_manager_standard_frameworks",
57    "../interfaces/innerkits/cert_manager_standard/main:cert_manager_sdk",
58  ]
59  external_deps = [
60    "access_token:libaccesstoken_sdk",
61    "access_token:libnativetoken",
62    "access_token:libtoken_setproc",
63    "bounds_checking_function:libsec_static",
64    "c_utils:utils",
65    "googletest:gtest",
66    "openssl:libcrypto_shared",
67  ]
68  resource_config_file = "./resource/certificate_manager/ohos_test.xml"
69
70  defines = []
71  if (certificate_manager_deps_huks_enabled == "software") {
72    defines += [ "DEPS_HKS_UNTRUSTED_RUNNING_ENV" ]
73  }
74}
75
76group("unittest") {
77  testonly = true
78  deps = [ ":cm_sdk_test" ]
79}
80
81group("module_test") {
82  testonly = true
83  deps = [ "./unittest/module_test:cm_module_test" ]
84}
85
86group("permission_test") {
87  testonly = true
88  deps = [
89    "./unittest/common_permission_test:cm_common_permission_test",
90    "./unittest/inner_permission_test:cm_inner_permission_test",
91  ]
92}
93
94group("multi_thread_test") {
95  testonly = true
96  deps = [ "./unittest/multi_thread_test:cm_multi_thread_test" ]
97}
98