• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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
17config("utest_config") {
18  cflags = [
19    "-Wno-implicit-fallthrough",
20    "-Wno-unused-function",
21    "-Dprivate=public",
22    "-Dprotected=public",
23  ]
24
25  cflags_cc = [
26    "-Wno-implicit-fallthrough",
27    "-fexceptions",
28  ]
29  ldflags = [ "--coverage" ]
30
31  include_dirs = [
32    "${appspawn_path}/test/mock/include",
33    "${appspawn_path}/common",
34    "${appspawn_path}/standard",
35    "${appspawn_path}/adapter",
36    "${appspawn_path}/interfaces/innerkits/include",
37    "${appspawn_path}/util/include",
38    "//commonlibrary/c_utils/base/include",
39    "ability_runtime_kits_path/appkit/native/app/include",
40    "${ability_runtime_path}/interfaces/innerkits/app_manager/include/appmgr",
41    "${ability_runtime_path}/interfaces/innerkits/ability_manager/include",
42    "ability_runtime_kits_path/ability/native/include",
43    "${ability_runtime_path}/services/abilitymgr/include",
44    "//base/global/resource_management/interfaces/inner_api/include",
45    "//base/security/access_token/interfaces/innerkits/token_setproc/include",
46    "//base/startup/init/services/log",
47    "//base/startup/init/services/include",
48    "//base/startup/init/services/loopevent/include",
49    "//base/startup/init/interfaces/innerkits/include",
50    "//third_party/json/include",
51  ]
52}
53
54ohos_unittest("AppSpawn_ut") {
55  module_out_path = "${module_output_path}"
56
57  defines = [
58    "usleep(time) = MockSleep(time)",
59    "APPSPAWN_TEST",
60  ]
61
62  sources = [
63    "${appspawn_path}/adapter/appspawn_ace.cpp",
64    "${appspawn_path}/adapter/appspawn_adapter.cpp",
65    "${appspawn_path}/adapter/appspawn_sandbox.cpp",
66    "${appspawn_path}/common/appspawn_server.c",
67    "${appspawn_path}/interfaces/innerkits/client/appspawn_socket.cpp",
68    "${appspawn_path}/interfaces/innerkits/client/client_socket.cpp",
69    "${appspawn_path}/standard/appspawn_process.c",
70    "${appspawn_path}/standard/appspawn_service.c",
71    "${appspawn_path}/util/src/json_utils.cpp",
72    "${appspawn_path}/util/src/sandbox_utils.cpp",
73  ]
74
75  sources += [
76    "${appspawn_path}/test/unittest/app_spawn_socket_test/app_spawn_socket_test.cpp",
77    "${appspawn_path}/test/unittest/app_spawn_standard_test/app_spawn_sandbox_test.cpp",
78    "${appspawn_path}/test/unittest/app_spawn_standard_test/app_spawn_standard_test.cpp",
79    "${appspawn_path}/test/unittest/client_socket_test/client_socket_test.cpp",
80  ]
81
82  configs = [ "//base/startup/appspawn/test/unittest:utest_config" ]
83
84  deps = [
85    "${ability_runtime_path}/frameworks/native/appkit:appkit_native",
86    "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
87  ]
88
89  external_deps = [
90    "ability_base:want",
91    "ability_runtime:app_manager",
92    "ability_runtime:runtime",
93    "bundle_framework:appexecfwk_base",
94    "bundle_framework:appexecfwk_core",
95    "c_utils:utils",
96    "eventhandler:libeventhandler",
97    "hitrace_native:hitrace_meter",
98    "hiviewdfx_hilog_native:libhilog",
99    "init:libbegetutil",
100    "ipc:ipc_core",
101    "napi:ace_napi",
102  ]
103}
104
105group("unittest") {
106  testonly = true
107
108  deps = [ ":AppSpawn_ut" ]
109}
110