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 = "${module_output_path}" 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/module_engine/include", 43 "${appspawn_path}/modules/sysevent", 44 "${appspawn_innerkits_path}/client", 45 "${appspawn_innerkits_path}/include", 46 "${appspawn_innerkits_path}/permission", 47 "${appspawn_path}/util/include", 48 "${appspawn_path}/test/unittest", 49 "${appspawn_path}/test/mock", 50 ] 51 52 # client 53 sources = [ 54 "${appspawn_innerkits_path}/client/appspawn_client.c", 55 "${appspawn_innerkits_path}/client/appspawn_msg.c", 56 "${appspawn_innerkits_path}/permission/appspawn_mount_permission.c", 57 "${appspawn_path}/modules/sandbox/appspawn_permission.c", 58 ] 59 60 # server 61 sources += [ 62 "${appspawn_path}/common/appspawn_server.c", 63 "${appspawn_path}/common/appspawn_trace.cpp", 64 "${appspawn_path}/modules/common/appspawn_dfx_dump.cpp", 65 "${appspawn_path}/modules/modulemgr/appspawn_modulemgr.c", 66 "${appspawn_path}/standard/appspawn_appmgr.c", 67 "${appspawn_path}/standard/appspawn_msgmgr.c", 68 "${appspawn_path}/standard/appspawn_service.c", 69 "${appspawn_path}/standard/nwebspawn_launcher.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 "hilog:libhilog", 91 "hitrace:hitrace_meter", 92 "init:libbegetutil", 93 ] 94 if (enable_appspawn_dump_catcher) { 95 external_deps += [ "faultloggerd:libdfx_dumpcatcher" ] 96 } 97 if (appspawn_report_event) { 98 external_deps += [ "hisysevent:libhisysevent" ] 99 sources += [ "${appspawn_path}/modules/sysevent/appspawn_hisysevent.cpp" ] 100 } 101 if (build_selinux) { 102 defines += [ "WITH_SELINUX" ] 103 external_deps += [ 104 "selinux:libselinux", 105 "selinux_adapter:libhap_restorecon", 106 ] 107 } 108} 109