mirror of
https://gitee.com/openharmony/startup_appspawn
synced 2024-11-23 15:10:44 +00:00
19df375286
Signed-off-by: xuyong <xuyong59@huawei.com>
147 lines
4.8 KiB
Plaintext
147 lines
4.8 KiB
Plaintext
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
import("//base/startup/appspawn/appspawn.gni")
|
|
import("//build/test.gni")
|
|
|
|
config("utest_config") {
|
|
cflags = [
|
|
"-Wno-implicit-fallthrough",
|
|
"-Wno-unused-function",
|
|
"-Dprivate=public",
|
|
"-Dprotected=public",
|
|
]
|
|
|
|
cflags_cc = [
|
|
"-Wno-implicit-fallthrough",
|
|
"-fexceptions",
|
|
]
|
|
|
|
if (build_selinux) {
|
|
cflags += [ "-DWITH_SELINUX" ]
|
|
}
|
|
|
|
if (build_seccomp) {
|
|
cflags += [ "-DWITH_SECCOMP" ]
|
|
}
|
|
|
|
include_dirs = [
|
|
"${appspawn_path}/test/unittest",
|
|
"${appspawn_path}/test/mock/include",
|
|
"${appspawn_path}/common",
|
|
"${appspawn_path}/standard",
|
|
"${appspawn_path}/adapter",
|
|
"${appspawn_path}/adapter/sysevent",
|
|
"${appspawn_path}/interfaces/innerkits/include",
|
|
"${appspawn_path}/util/include",
|
|
"//commonlibrary/c_utils/base/include",
|
|
"ability_runtime_kits_path/appkit/native/app/include",
|
|
"${ability_runtime_path}/interfaces/innerkits/app_manager/include/appmgr",
|
|
"${ability_runtime_path}/interfaces/innerkits/ability_manager/include",
|
|
"ability_runtime_kits_path/ability/native/include",
|
|
"${ability_runtime_path}/services/abilitymgr/include",
|
|
"//base/global/resource_management/interfaces/inner_api/include",
|
|
"//base/security/access_token/interfaces/innerkits/token_setproc/include",
|
|
"//base/security/selinux_adapter/interfaces/policycoreutils/include",
|
|
"//base/startup/init/services/log",
|
|
"//base/startup/init/services/include",
|
|
"//base/startup/init/services/loopevent/include",
|
|
"//base/startup/init/services/loopevent/task",
|
|
"//base/startup/init/services/loopevent/utils",
|
|
"//base/startup/init/interfaces/innerkits/include",
|
|
"//base/startup/init/interfaces/innerkits/seccomp/include",
|
|
"//third_party/json/include",
|
|
"//third_party/selinux/libselinux/include",
|
|
]
|
|
}
|
|
|
|
ohos_unittest("AppSpawn_ut") {
|
|
module_out_path = "${module_output_path}"
|
|
|
|
defines = [
|
|
"clone=CloneStub",
|
|
"bind=BindStub",
|
|
"listen=ListenStub",
|
|
"lchown=LchownStub",
|
|
"lchmod=LchmodStub",
|
|
"getsockopt=GetsockoptStub",
|
|
"setgroups=SetgroupsStub",
|
|
"setresuid=SetresuidStub",
|
|
"setresgid=SetresgidStub",
|
|
"capset=CapsetStub",
|
|
"dlopen=DlopenStub",
|
|
"dlsym=DlsymStub",
|
|
"dlclose=DlcloseStub",
|
|
"waitpid=WaitpidStub",
|
|
"HapContext=HapContextStub",
|
|
"APPSPAWN_TEST",
|
|
"OHOS_DEBUG",
|
|
"GRAPHIC_PERMISSION_CHECK",
|
|
]
|
|
|
|
sources = [
|
|
"${appspawn_path}/adapter/appspawn_ace.cpp",
|
|
"${appspawn_path}/adapter/appspawn_adapter.cpp",
|
|
"${appspawn_path}/adapter/appspawn_sandbox.cpp",
|
|
"${appspawn_path}/common/appspawn_server.c",
|
|
"${appspawn_path}/interfaces/innerkits/client/appspawn_socket.cpp",
|
|
"${appspawn_path}/interfaces/innerkits/client/client_socket.cpp",
|
|
"${appspawn_path}/interfaces/innerkits/src/appspawn_mount_permission.cpp",
|
|
"${appspawn_path}/standard/appspawn_process.c",
|
|
"${appspawn_path}/standard/appspawn_service.c",
|
|
"${appspawn_path}/util/src/json_utils.cpp",
|
|
"${appspawn_path}/util/src/sandbox_utils.cpp",
|
|
]
|
|
|
|
sources += [
|
|
"${appspawn_path}/test/unittest/app_spawn_socket_test/app_spawn_socket_test.cpp",
|
|
"${appspawn_path}/test/unittest/app_spawn_standard_test/app_spawn_sandbox_test.cpp",
|
|
"${appspawn_path}/test/unittest/app_spawn_standard_test/app_spawn_standard_test.cpp",
|
|
"${appspawn_path}/test/unittest/app_spawn_stub.cpp",
|
|
"${appspawn_path}/test/unittest/client_socket_test/client_socket_test.cpp",
|
|
]
|
|
|
|
configs = [ "//base/startup/appspawn/test/unittest:utest_config" ]
|
|
|
|
external_deps = [
|
|
"ability_base:want",
|
|
"ability_runtime:app_manager",
|
|
"ability_runtime:appkit_native",
|
|
"ability_runtime:runtime",
|
|
"access_token:libtoken_setproc",
|
|
"bundle_framework:appexecfwk_base",
|
|
"bundle_framework:appexecfwk_core",
|
|
"c_utils:utils",
|
|
"config_policy:configpolicy_util",
|
|
"eventhandler:libeventhandler",
|
|
"hilog:libhilog",
|
|
"hitrace:hitrace_meter",
|
|
"init:libbegetutil",
|
|
"ipc:ipc_core",
|
|
"napi:ace_napi",
|
|
"resource_management:global_resmgr",
|
|
]
|
|
|
|
if (appspawn_report_event) {
|
|
defines += [ "REPORT_EVENT" ]
|
|
external_deps += [ "hisysevent:libhisysevent" ]
|
|
sources += [ "${appspawn_path}/adapter/sysevent/event_reporter.cpp" ]
|
|
}
|
|
}
|
|
|
|
group("unittest") {
|
|
testonly = true
|
|
|
|
deps = [ ":AppSpawn_ut" ]
|
|
}
|