• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//base/startup/appspawn/appspawn.gni")
15import("//build/test.gni")
16
17ohos_unittest("AppSpawn_client_ut") {
18  module_out_path = "appspawn/appspawn"
19  deps = []
20  if (appspawn_unittest_coverage) {
21    cflags = [ "--coverage" ]
22    ldflags = [ "--coverage" ]
23    cflags_cc = [ "--coverage" ]
24  }
25  defines = [
26    "APPSPAWN_BASE_DIR=\"/data/appspawn_ut\"",
27    "APPSPAWN_TEST",
28    "APPSPAWN_CLIENT",
29    "OHOS_DEBUG",
30    "USER_TIMER_TO_CHECK",
31    "APPSPAWN_LABEL=\"APPSPAWN_CLENT_UT\"",
32  ]
33
34  include_dirs = [
35    "${appspawn_path}",
36    "${appspawn_path}/common",
37    "${appspawn_path}/standard",
38    "${appspawn_path}/modules/modulemgr",
39    "${appspawn_path}/modules/ace_adapter",
40    "${appspawn_path}/modules/common",
41    "${appspawn_path}/modules/sandbox",
42    "${appspawn_path}/modules/sandbox/normal",
43    "${appspawn_path}/modules/module_engine/include",
44    "${appspawn_path}/modules/sysevent",
45    "${appspawn_innerkits_path}/client",
46    "${appspawn_innerkits_path}/include",
47    "${appspawn_innerkits_path}/permission",
48    "${appspawn_path}/util/include",
49    "${appspawn_path}/test/unittest",
50    "${appspawn_path}/test/mock",
51  ]
52
53  # client
54  sources = [
55    "${appspawn_innerkits_path}/client/appspawn_client.c",
56    "${appspawn_innerkits_path}/client/appspawn_msg.c",
57    "${appspawn_innerkits_path}/permission/appspawn_mount_permission.c",
58    "${appspawn_path}/modules/sandbox/appspawn_permission.c",
59  ]
60
61  # server
62  sources += [
63    "${appspawn_path}/common/appspawn_server.c",
64    "${appspawn_path}/common/appspawn_trace.cpp",
65    "${appspawn_path}/modules/common/appspawn_dfx_dump.cpp",
66    "${appspawn_path}/modules/modulemgr/appspawn_modulemgr.c",
67    "${appspawn_path}/standard/appspawn_appmgr.c",
68    "${appspawn_path}/standard/appspawn_msgmgr.c",
69    "${appspawn_path}/standard/appspawn_service.c",
70    "${appspawn_path}/util/src/appspawn_utils.c",
71  ]
72
73  sources += [
74    "${appspawn_path}/test/unittest/app_spawn_client_test/app_spawn_client_test.cpp",
75    "${appspawn_path}/test/unittest/app_spawn_client_test/app_spawn_interface_test.cpp",
76    "${appspawn_path}/test/unittest/app_spawn_test_helper.cpp",
77  ]
78
79  if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) {
80    defines += [ "APPSPAWN_SANDBOX_NEW" ]
81  }
82
83  if (asan_detector || is_asan) {
84    defines += [ "ASAN_DETECTOR" ]
85  }
86  external_deps = [
87    "cJSON:cjson",
88    "c_utils:utils",
89    "config_policy:configpolicy_util",
90    "ffrt:libffrt",
91    "hilog:libhilog",
92    "hitrace:hitrace_meter",
93    "init:libbegetutil",
94  ]
95
96  if (appspawn_hitrace_option == true) {
97    defines += [ "APPSPAWN_HITRACE_OPTION" ]
98    external_deps += [ "hitrace:libhitrace_option" ]
99  }
100
101  if (enable_appspawn_dump_catcher) {
102    external_deps += [ "faultloggerd:libdfx_dumpcatcher" ]
103  }
104  if (appspawn_report_event) {
105    external_deps += [ "hisysevent:libhisysevent" ]
106    sources += [ "${appspawn_path}/modules/sysevent/appspawn_hisysevent.cpp" ]
107  }
108  if (build_selinux) {
109    defines += [ "WITH_SELINUX" ]
110    external_deps += [
111      "selinux:libselinux",
112      "selinux_adapter:libhap_restorecon",
113    ]
114  }
115}
116