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.
13
14import("//base/update/sys_installer/sys_installer_default_cfg.gni")
15import("//build/test.gni")
16
17sys_installer_path = rebase_path("${sys_installer_absolutely_path}", ".")
18module_output_path = "sys_installer/sys_installer_test"
19
20config("utest_config") {
21  visibility = [ ":*" ]
22
23  cflags = [
24    "-fprofile-arcs",
25    "-Wno-implicit-fallthrough",
26    "-Wno-unused-function",
27  ]
28  cflags_cc = [ "-Wno-implicit-fallthrough" ]
29
30  ldflags = [ "--coverage" ]
31}
32
33ohos_unittest("sys_installer_unittest") {
34  testonly = true
35  module_out_path = module_output_path
36  sources = [
37    "${sys_installer_path}/interfaces/innerkits/ipc_client/src/sys_installer_kits_impl.cpp",
38    "ipc_test/sys_installer_ipc_test.cpp",
39  ]
40
41  include_dirs = [
42    "${sys_installer_path}/interfaces/inner_api/include",
43    "${sys_installer_path}/interfaces/innerkits/ipc_client/include",
44    "${sys_installer_path}/test/unitest",
45  ]
46  deps = [
47    "${sys_installer_path}/interfaces/innerkits/ipc_client:libsysinstallerkits",
48  ]
49
50  deps += [ "${sys_installer_path}/test/unittest:sys_installer_client_test" ]
51  external_deps = [
52    "bounds_checking_function:libsec_static",
53    "googletest:gmock_main",
54    "googletest:gtest_main",
55    "updater:libupdaterlog",
56  ]
57
58  cflags_cc = [ "-fexceptions" ]
59
60  defines = [
61    "UPDATER_UT",
62    "BUILD_OHOS",
63    "HDC_DEBUG",
64    "HARMONY_PROJECT",
65  ]
66
67  public_configs = [ ":utest_config" ]
68  install_enable = true
69  part_name = "sys_installer"
70}
71
72ohos_executable("sys_installer_client_test") {
73  sources = [ "${sys_installer_path}/interfaces/innerkits/ipc_client/src/sys_installer_client.cpp" ]
74
75  include_dirs = [
76    "${sys_installer_path}/interfaces/innerkits/ipc_client/include",
77    "${sys_installer_path}/interfaces/inner_api/include",
78  ]
79
80  deps = [
81    "${sys_installer_path}/interfaces/innerkits/ipc_client:libsysinstallerkits",
82  ]
83
84  external_deps = [
85    "bounds_checking_function:libsec_static",
86    "c_utils:utils",
87    "init:libbegetutil",
88    "ipc:ipc_core",
89    "safwk:system_ability_fwk",
90    "samgr:samgr_proxy",
91  ]
92  install_enable = true
93  part_name = "sys_installer"
94}
95