mirror of
https://gitee.com/openharmony/startup_init
synced 2025-01-07 11:13:01 +00:00
4278d9b4a8
Signed-off-by: laiguizhong <laiguizhong@huawei.com> Change-Id: I9408b1109b66d0ec54fea0cb772439f4911fb56a
255 lines
11 KiB
Plaintext
Executable File
255 lines
11 KiB
Plaintext
Executable File
# Copyright (c) 2021 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/init_lite/begetd.gni")
|
|
import("//build/test.gni")
|
|
|
|
config("utest_config") {
|
|
visibility = [ ":*" ]
|
|
|
|
cflags = [
|
|
"-fprofile-arcs",
|
|
"-ftest-coverage",
|
|
"-Wno-implicit-fallthrough",
|
|
"-Wno-unused-function",
|
|
]
|
|
cflags_cc = [
|
|
"-Wno-implicit-fallthrough",
|
|
"-fexceptions",
|
|
]
|
|
|
|
ldflags = [ "--coverage" ]
|
|
}
|
|
|
|
ohos_unittest("init_ut") {
|
|
module_out_path = "startup/init"
|
|
sources = [
|
|
"//base/startup/init_lite/interfaces/innerkits/file/init_file.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/fs_manager/fstab.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/fs_manager/fstab_mount.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/reboot/init_reboot_innerkits.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/sandbox/sandbox.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/sandbox/sandbox_namespace.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/socket/init_socket.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/syspara/param_comm.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/syspara/parameter.c",
|
|
"//base/startup/init_lite/interfaces/innerkits/syspara/sysversion.c",
|
|
"//base/startup/init_lite/services/begetctl/param_cmd.c",
|
|
"//base/startup/init_lite/services/begetctl/shell/shell_bas.c",
|
|
"//base/startup/init_lite/services/begetctl/shell/shell_main.c",
|
|
"//base/startup/init_lite/services/init/adapter/init_adapter.c",
|
|
"//base/startup/init_lite/services/init/init_capability.c",
|
|
"//base/startup/init_lite/services/init/init_common_cmds.c",
|
|
"//base/startup/init_lite/services/init/init_common_service.c",
|
|
"//base/startup/init_lite/services/init/init_config.c",
|
|
"//base/startup/init_lite/services/init/init_group_manager.c",
|
|
"//base/startup/init_lite/services/init/init_service_file.c",
|
|
"//base/startup/init_lite/services/init/init_service_manager.c",
|
|
"//base/startup/init_lite/services/init/init_service_socket.c",
|
|
"//base/startup/init_lite/services/init/standard/device.c",
|
|
"//base/startup/init_lite/services/init/standard/init.c",
|
|
"//base/startup/init_lite/services/init/standard/init_cmds.c",
|
|
"//base/startup/init_lite/services/init/standard/init_jobs.c",
|
|
"//base/startup/init_lite/services/init/standard/init_mount.c",
|
|
"//base/startup/init_lite/services/init/standard/init_plugin_manager.c",
|
|
"//base/startup/init_lite/services/init/standard/init_reboot.c",
|
|
"//base/startup/init_lite/services/init/standard/init_service.c",
|
|
"//base/startup/init_lite/services/init/standard/init_signal_handler.c",
|
|
"//base/startup/init_lite/services/log/init_log.c",
|
|
"//base/startup/init_lite/services/loopevent/loop/le_epoll.c",
|
|
"//base/startup/init_lite/services/loopevent/loop/le_loop.c",
|
|
"//base/startup/init_lite/services/loopevent/signal/le_signal.c",
|
|
"//base/startup/init_lite/services/loopevent/socket/le_socket.c",
|
|
"//base/startup/init_lite/services/loopevent/task/le_asynctask.c",
|
|
"//base/startup/init_lite/services/loopevent/task/le_streamtask.c",
|
|
"//base/startup/init_lite/services/loopevent/task/le_task.c",
|
|
"//base/startup/init_lite/services/loopevent/task/le_watchtask.c",
|
|
"//base/startup/init_lite/services/loopevent/timer/le_timer.c",
|
|
"//base/startup/init_lite/services/loopevent/utils/le_utils.c",
|
|
"//base/startup/init_lite/services/param/adapter/param_dac.c",
|
|
"//base/startup/init_lite/services/param/adapter/param_persistadp.c",
|
|
"//base/startup/init_lite/services/param/linux/param_message.c",
|
|
"//base/startup/init_lite/services/param/linux/param_msgadp.c",
|
|
"//base/startup/init_lite/services/param/linux/param_osadp.c",
|
|
"//base/startup/init_lite/services/param/linux/param_request.c",
|
|
"//base/startup/init_lite/services/param/linux/param_service.c",
|
|
"//base/startup/init_lite/services/param/manager/param_manager.c",
|
|
"//base/startup/init_lite/services/param/manager/param_persist.c",
|
|
"//base/startup/init_lite/services/param/manager/param_trie.c",
|
|
"//base/startup/init_lite/services/param/manager/param_utils.c",
|
|
"//base/startup/init_lite/services/param/trigger/trigger_checker.c",
|
|
"//base/startup/init_lite/services/param/trigger/trigger_manager.c",
|
|
"//base/startup/init_lite/services/param/trigger/trigger_processor.c",
|
|
"//base/startup/init_lite/services/utils/init_hashmap.c",
|
|
"//base/startup/init_lite/services/utils/init_utils.c",
|
|
"//base/startup/init_lite/services/utils/list.c",
|
|
"//base/startup/init_lite/ueventd/standard/ueventd_parameter.c",
|
|
"//base/startup/init_lite/ueventd/ueventd.c",
|
|
"//base/startup/init_lite/ueventd/ueventd_device_handler.c",
|
|
"//base/startup/init_lite/ueventd/ueventd_firmware_handler.c",
|
|
"//base/startup/init_lite/ueventd/ueventd_read_cfg.c",
|
|
"//base/startup/init_lite/ueventd/ueventd_socket.c",
|
|
]
|
|
|
|
if (defined(build_selinux) && build_selinux) {
|
|
sources +=
|
|
[ "//base/startup/init_lite/services/param/adapter/param_selinux.c" ]
|
|
}
|
|
|
|
if (param_feature_watcher) {
|
|
sources += [
|
|
"//base/startup/init_lite/services/param/watcher/agent/watcher.cpp",
|
|
"//base/startup/init_lite/services/param/watcher/agent/watcher_manager_kits.cpp",
|
|
"//base/startup/init_lite/services/param/watcher/agent/watcher_manager_proxy.cpp",
|
|
"//base/startup/init_lite/services/param/watcher/agent/watcher_stub.cpp",
|
|
"//base/startup/init_lite/services/param/watcher/proxy/watcher_manager.cpp",
|
|
"//base/startup/init_lite/services/param/watcher/proxy/watcher_manager_stub.cpp",
|
|
"//base/startup/init_lite/services/param/watcher/proxy/watcher_proxy.cpp",
|
|
]
|
|
}
|
|
|
|
sources += [
|
|
"begetctl/begetctl_unittest.cpp",
|
|
"init/SignalInitUnitTest.cpp",
|
|
"init/cmds_unittest.cpp",
|
|
"init/group_unittest.cpp",
|
|
"init/init_reboot_unittest.cpp",
|
|
"init/mount_unittest.cpp",
|
|
"init/plugin_unittest.cpp",
|
|
"init/service_file_unittest.cpp",
|
|
"init/service_socket_unittest.cpp",
|
|
"init/utils_unittest.cpp",
|
|
"innerkits/innerkits_unittest.cpp",
|
|
"param/client_unittest.cpp",
|
|
"param/dac_unittest.cpp",
|
|
"param/param_shell_unittest.cpp",
|
|
"param/param_stub.cpp",
|
|
"param/param_unittest.cpp",
|
|
"param/paramservice_unittest.cpp",
|
|
"param/trigger_unittest.cpp",
|
|
"syspara/syspara_unittest.cpp",
|
|
"ueventd/ueventd_config_unittest.cpp",
|
|
]
|
|
|
|
configs = [ "//base/startup/init_lite/test/unittest:utest_config" ]
|
|
|
|
include_dirs = [
|
|
"//base/customization/config_policy/interfaces/innerkits/include",
|
|
"//base/startup/init_lite/services/init/standard",
|
|
"//base/startup/init_lite/interfaces/innerkits/include",
|
|
"//base/startup/init_lite/interfaces/innerkits/include/syspara",
|
|
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
|
|
"//base/startup/init_lite/interfaces/innerkits/syspara",
|
|
"//base/startup/init_lite/services/begetctl",
|
|
"//base/startup/init_lite/services/begetctl/shell",
|
|
"//base/startup/init_lite/services/include",
|
|
"//base/startup/init_lite/services/init/include",
|
|
"//base/startup/init_lite/services/include/param",
|
|
"//base/startup/init_lite/services/log",
|
|
"//base/startup/init_lite/services/loopevent/include",
|
|
"//base/startup/init_lite/services/loopevent/loop",
|
|
"//base/startup/init_lite/services/loopevent/socket",
|
|
"//base/startup/init_lite/services/loopevent/signal",
|
|
"//base/startup/init_lite/services/loopevent/task",
|
|
"//base/startup/init_lite/services/loopevent/timer",
|
|
"//base/startup/init_lite/services/loopevent/utils",
|
|
"//base/startup/init_lite/services/param/adapter",
|
|
"//base/startup/init_lite/services/param/linux",
|
|
"//base/startup/init_lite/services/param/include",
|
|
"//base/startup/init_lite/services/param/watcher/agent",
|
|
"//base/startup/init_lite/services/param/watcher/include",
|
|
"//base/startup/init_lite/services/param/watcher/proxy",
|
|
"//base/startup/init_lite/test/unittest",
|
|
"//base/startup/init_lite/test/unittest/param",
|
|
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
|
"//foundation/distributedschedule/safwk/services/safwk/include",
|
|
"//foundation/distributedschedule/safwk/interfaces/innerkits/safwk",
|
|
"//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include",
|
|
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
|
"//base/startup/init_lite/ueventd/include",
|
|
"//utils/system/safwk/native/include",
|
|
"//third_party/bounds_checking_function/include",
|
|
"//third_party/cJSON",
|
|
"//base/security/access_token/interfaces/innerkits/token_setproc/include",
|
|
"//base/security/access_token/interfaces/innerkits/nativetoken/include",
|
|
"//base/startup/init_lite/interfaces/innerkits/sandbox/include",
|
|
]
|
|
|
|
deps = [
|
|
"//base/customization/config_policy/frameworks/config_policy:configpolicy_util_for_init_static",
|
|
"//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken",
|
|
"//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
|
|
"//third_party/bounds_checking_function:libsec_static",
|
|
"//third_party/cJSON:cjson_static",
|
|
"//third_party/googletest:gmock",
|
|
"//third_party/googletest:gtest",
|
|
"//third_party/openssl:libcrypto_shared",
|
|
]
|
|
|
|
defines = [
|
|
"READ_CHECK",
|
|
"INIT_AGENT",
|
|
"INIT_FILE",
|
|
"STARTUP_INIT_TEST",
|
|
"PARAM_SUPPORT_DAC",
|
|
"_GNU_SOURCE",
|
|
"PARAM_SUPPORT_TRIGGER",
|
|
]
|
|
defines += [ "_GNU_SOURCE" ]
|
|
|
|
external_deps = [
|
|
"hiviewdfx_hilog_native:libhilog",
|
|
"init:libinit_plugin_engine",
|
|
"utils_base:utils",
|
|
]
|
|
|
|
if (!defined(ohos_lite) && param_feature_watcher) {
|
|
sources += [
|
|
"param/watcher_agent_unittest.cpp",
|
|
"param/watcher_proxy_unittest.cpp",
|
|
]
|
|
external_deps += [
|
|
"ipc:ipc_core",
|
|
"safwk:system_ability_fwk",
|
|
"samgr_standard:samgr_proxy",
|
|
]
|
|
}
|
|
|
|
if (defined(build_selinux) && build_selinux) {
|
|
sources += [ "param/selinux_unittest.cpp" ]
|
|
include_dirs += [
|
|
"//third_party/selinux/libselinux/include/",
|
|
"//base/security/selinux/interfaces/policycoreutils/include/",
|
|
]
|
|
deps += [
|
|
"//base/security/selinux:libload_policy",
|
|
"//base/security/selinux:librestorecon",
|
|
"//third_party/selinux:libselinux",
|
|
]
|
|
defines += [
|
|
"WITH_SELINUX",
|
|
"PARAM_SUPPORT_SELINUX",
|
|
]
|
|
}
|
|
|
|
cflags_cc = [ "-fexceptions" ]
|
|
sources += [
|
|
"init/loopevent_unittest.cpp",
|
|
"init/service_unittest.cpp",
|
|
]
|
|
}
|
|
|
|
group("init_test") {
|
|
testonly = true
|
|
deps = [ ":init_ut" ]
|
|
}
|