# 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. #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/ohos.gni") import("//build/test.gni") import("../../../services/samgr/var.gni") module_output_path = "samgr/samgr" samgr_dir = "//foundation/systemabilitymgr/samgr" samgr_services_dir = "${samgr_dir}/services/samgr/native" config("sam_fuzz_test_config") { include_dirs = [ "//foundation/systemabilitymgr/samgr/services/dfx/include", "//foundation/systemabilitymgr/samgr/services/lsamgr/include", "//foundation/systemabilitymgr/samgr/services/samgr/native/test/unittest/include", ] } ##############################fuzztest########################################## ohos_fuzztest("SystemAbilityManagerFuzzTest") { module_out_path = module_output_path fuzz_config_file = "//foundation/systemabilitymgr/samgr/test/fuzztest/systemabilitymanager_fuzzer" configs = [ ":sam_fuzz_test_config", "${samgr_dir}/services/samgr/native:sam_config", "//foundation/systemabilitymgr/samgr/test/resource:coverage_flags", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "${samgr_dir}/utils/native/source/tools.cpp", "${samgr_services_dir}/source/collect/device_param_collect.cpp", "${samgr_services_dir}/source/collect/device_status_collect_manager.cpp", "${samgr_services_dir}/source/collect/device_timed_collect.cpp", "${samgr_services_dir}/source/collect/icollect_plugin.cpp", "${samgr_services_dir}/source/memory_guard.cpp", "${samgr_services_dir}/source/schedule/system_ability_event_handler.cpp", "${samgr_services_dir}/source/schedule/system_ability_state_machine.cpp", "${samgr_services_dir}/source/schedule/system_ability_state_scheduler.cpp", "${samgr_services_dir}/source/system_ability_manager.cpp", "${samgr_services_dir}/source/system_ability_manager_stub.cpp", "//foundation/systemabilitymgr/samgr/services/dfx/source/hicollie_helper.cpp", "//foundation/systemabilitymgr/samgr/services/dfx/source/hisysevent_adapter.cpp", "//foundation/systemabilitymgr/samgr/services/samgr/native/source/ability_death_recipient.cpp", "//foundation/systemabilitymgr/samgr/services/samgr/native/source/rpc_callback_imp.cpp", "//foundation/systemabilitymgr/samgr/services/samgr/native/test/unittest/src/mock_permission.cpp", "systemabilitymanager_fuzzer.cpp", ] deps = [] external_deps = [ "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "c_utils:utils", "eventhandler:libeventhandler", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", "init:libbeget_proxy", "init:libbegetutil", "ipc:ipc_core", "ipc:libdbinder", "safwk:system_ability_fwk", "samgr:samgr_common", "samgr:samgr_proxy", ] defines = [] if (hicollie_able) { external_deps += [ "hicollie:libhicollie" ] defines += [ "HICOLLIE_ENABLE" ] } if (ressched_able) { external_deps += [ "resource_schedule_service:ressched_client" ] defines += [ "RESSCHED_ENABLE" ] } if (support_device_manager) { sources += [ "${samgr_services_dir}/source/collect/device_networking_collect.cpp" ] external_deps += [ "device_manager:devicemanagersdk" ] defines += [ "SUPPORT_DEVICE_MANAGER" ] } } group("fuzztest") { testonly = true deps = [] deps += [ # deps file ":SystemAbilityManagerFuzzTest", ] }