1# Copyright (c) 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/test.gni")
15import("//drivers/peripheral/secure_element/secure_element.gni")
16SE_DIR = "../../"
17
18config("se_unit_test_config") {
19  visibility = [ ":*" ]
20
21  include_dirs = [
22    "$SE_DIR/hdi_service",
23    "$SE_DIR/secure_element_ca_proxy",
24    "$SE_DIR/vendor_adaptor",
25    "$SE_DIR/test/unittest/mock",
26  ]
27
28  cflags_cc = [ "-fexceptions" ]
29  cflags = [ "--coverage" ]
30  ldflags = [ "--coverage" ]
31}
32
33unit_test_deps = [
34  "$SE_DIR/hdi_service:libsecure_element_interface_service_1.0",
35  "$SE_DIR/hdi_service:se_hdi_driver",
36  "$SE_DIR/vendor_adaptor:se_vendor_adaptor",
37  "../../../../interface/secure_element/v1_0:libsecure_element_proxy_1.0",
38  "//third_party/googletest:gmock_main",
39  "//third_party/googletest:gtest_main",
40]
41
42unit_test_external_deps = [
43  "c_utils:utils",
44  "drivers_interface_secure_element:secure_element_idl_headers",
45  "hdf_core:libhdf_utils",
46  "hilog:libhilog",
47  "ipc:ipc_core",
48  "ipc:ipc_single",
49]
50
51test_out_path =
52    "drivers_peripheral_secure_element/drivers_peripheral_secure_element"
53
54ohos_unittest("se_impl_test") {
55  module_out_path = test_out_path
56
57  sources = [ "se_impl_test/se_impl_test.cpp" ]
58
59  configs = [ ":se_unit_test_config" ]
60
61  deps = unit_test_deps
62
63  external_deps = unit_test_external_deps
64
65  part_name = "drivers_peripheral_secure_element"
66  subsystem_name = "hdf"
67}
68
69ohos_unittest("se_vendor_adaptions_test") {
70  module_out_path = test_out_path
71
72  sources = [ "se_vendor_adaptions_test/se_vendor_adaptions_test.cpp" ]
73
74  configs = [ ":se_unit_test_config" ]
75
76  deps = unit_test_deps
77
78  external_deps = unit_test_external_deps
79
80  part_name = "drivers_peripheral_secure_element"
81  subsystem_name = "hdf"
82}
83
84ohos_unittest("se_vendor_adaptions_mock_test") {
85  module_out_path = test_out_path
86
87  sources = [
88    "$SE_DIR/test/unittest/mock/mock.cpp",
89    "se_vendor_adaptions_mock_test/se_vendor_adaptions_mock_test.cpp",
90  ]
91
92  configs = [ ":se_unit_test_config" ]
93
94  deps = unit_test_deps
95
96  external_deps = unit_test_external_deps
97
98  part_name = "drivers_peripheral_secure_element"
99  subsystem_name = "hdf"
100}
101
102group("hdf_se_unittest") {
103  testonly = true
104
105  deps = [
106    ":se_impl_test",
107    ":se_vendor_adaptions_mock_test",
108    ":se_vendor_adaptions_test",
109  ]
110}
111