15ba71b47Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
25ba71b47Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35ba71b47Sopenharmony_ci# you may not use this file except in compliance with the License.
45ba71b47Sopenharmony_ci# You may obtain a copy of the License at
55ba71b47Sopenharmony_ci#
65ba71b47Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75ba71b47Sopenharmony_ci#
85ba71b47Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95ba71b47Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105ba71b47Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115ba71b47Sopenharmony_ci# See the License for the specific language governing permissions and
125ba71b47Sopenharmony_ci# limitations under the License.
135ba71b47Sopenharmony_ci
145ba71b47Sopenharmony_ci#####################hydra-fuzz###################
155ba71b47Sopenharmony_ciimport("//build/config/features.gni")
165ba71b47Sopenharmony_ciimport("//build/ohos.gni")
175ba71b47Sopenharmony_ciimport("//build/test.gni")
185ba71b47Sopenharmony_ciimport("../../../services/samgr/var.gni")
195ba71b47Sopenharmony_cimodule_output_path = "samgr/samgr"
205ba71b47Sopenharmony_cisamgr_dir = "../../.."
215ba71b47Sopenharmony_cisamgr_services_dir = "${samgr_dir}/services/samgr/native"
225ba71b47Sopenharmony_ci
235ba71b47Sopenharmony_ciconfig("sam_fuzz_test_config") {
245ba71b47Sopenharmony_ci  include_dirs = [
255ba71b47Sopenharmony_ci    "${samgr_dir}/services/dfx/include",
265ba71b47Sopenharmony_ci    "${samgr_dir}/services/lsamgr/include",
275ba71b47Sopenharmony_ci    "${samgr_dir}/services/samgr/native/test/unittest/include",
285ba71b47Sopenharmony_ci  ]
295ba71b47Sopenharmony_ci}
305ba71b47Sopenharmony_ci
315ba71b47Sopenharmony_ci##############################fuzztest##########################################
325ba71b47Sopenharmony_ciohos_fuzztest("SamgrDumperFuzzTest") {
335ba71b47Sopenharmony_ci  module_out_path = module_output_path
345ba71b47Sopenharmony_ci
355ba71b47Sopenharmony_ci  fuzz_config_file = "${samgr_dir}/test/fuzztest/samgrdumper_fuzzer"
365ba71b47Sopenharmony_ci
375ba71b47Sopenharmony_ci  configs = [
385ba71b47Sopenharmony_ci    ":sam_fuzz_test_config",
395ba71b47Sopenharmony_ci    "${samgr_dir}/services/samgr/native:sam_config",
405ba71b47Sopenharmony_ci    "${samgr_dir}/test/resource:coverage_flags",
415ba71b47Sopenharmony_ci  ]
425ba71b47Sopenharmony_ci
435ba71b47Sopenharmony_ci  cflags = [
445ba71b47Sopenharmony_ci    "-g",
455ba71b47Sopenharmony_ci    "-O0",
465ba71b47Sopenharmony_ci    "-Wno-unused-variable",
475ba71b47Sopenharmony_ci    "-fno-omit-frame-pointer",
485ba71b47Sopenharmony_ci  ]
495ba71b47Sopenharmony_ci  sources = [
505ba71b47Sopenharmony_ci    "${samgr_dir}/services/dfx/source/hisysevent_adapter.cpp",
515ba71b47Sopenharmony_ci    "${samgr_dir}/utils/native/source/tools.cpp",
525ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/ability_death_recipient.cpp",
535ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/collect/device_param_collect.cpp",
545ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/collect/device_status_collect_manager.cpp",
555ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/collect/device_timed_collect.cpp",
565ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/collect/icollect_plugin.cpp",
575ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/ffrt_handler.cpp",
585ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/memory_guard.cpp",
595ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/rpc_callback_imp.cpp",
605ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/samgr_time_handler.cpp",
615ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/schedule/system_ability_event_handler.cpp",
625ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/schedule/system_ability_state_machine.cpp",
635ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/schedule/system_ability_state_scheduler.cpp",
645ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/system_ability_manager.cpp",
655ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/system_ability_manager_dumper.cpp",
665ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/system_ability_manager_stub.cpp",
675ba71b47Sopenharmony_ci    "${samgr_services_dir}/source/system_ability_manager_util.cpp",
685ba71b47Sopenharmony_ci    "${samgr_services_dir}/test/unittest/src/mock_permission.cpp",
695ba71b47Sopenharmony_ci    "samgrdumper_fuzzer.cpp",
705ba71b47Sopenharmony_ci  ]
715ba71b47Sopenharmony_ci  deps = []
725ba71b47Sopenharmony_ci
735ba71b47Sopenharmony_ci  external_deps = [
745ba71b47Sopenharmony_ci    "access_token:libaccesstoken_sdk",
755ba71b47Sopenharmony_ci    "access_token:libnativetoken_shared",
765ba71b47Sopenharmony_ci    "access_token:libtokensetproc_shared",
775ba71b47Sopenharmony_ci    "c_utils:utils",
785ba71b47Sopenharmony_ci    "eventhandler:libeventhandler",
795ba71b47Sopenharmony_ci    "ffrt:libffrt",
805ba71b47Sopenharmony_ci    "hilog:libhilog",
815ba71b47Sopenharmony_ci    "hisysevent:libhisysevent",
825ba71b47Sopenharmony_ci    "hitrace:hitrace_meter",
835ba71b47Sopenharmony_ci    "init:libbeget_proxy",
845ba71b47Sopenharmony_ci    "init:libbegetutil",
855ba71b47Sopenharmony_ci    "ipc:ipc_single",
865ba71b47Sopenharmony_ci    "ipc:libdbinder",
875ba71b47Sopenharmony_ci    "safwk:system_ability_fwk",
885ba71b47Sopenharmony_ci    "samgr:samgr_common",
895ba71b47Sopenharmony_ci    "samgr:samgr_proxy",
905ba71b47Sopenharmony_ci  ]
915ba71b47Sopenharmony_ci  defines = []
925ba71b47Sopenharmony_ci  if (hicollie_able) {
935ba71b47Sopenharmony_ci    external_deps += [ "hicollie:libhicollie" ]
945ba71b47Sopenharmony_ci    defines += [ "HICOLLIE_ENABLE" ]
955ba71b47Sopenharmony_ci  }
965ba71b47Sopenharmony_ci
975ba71b47Sopenharmony_ci  if (support_device_manager) {
985ba71b47Sopenharmony_ci    sources +=
995ba71b47Sopenharmony_ci        [ "${samgr_services_dir}/source/collect/device_networking_collect.cpp" ]
1005ba71b47Sopenharmony_ci    external_deps += [ "device_manager:devicemanagersdk" ]
1015ba71b47Sopenharmony_ci    defines += [ "SUPPORT_DEVICE_MANAGER" ]
1025ba71b47Sopenharmony_ci  }
1035ba71b47Sopenharmony_ci}
1045ba71b47Sopenharmony_ci
1055ba71b47Sopenharmony_cigroup("fuzztest") {
1065ba71b47Sopenharmony_ci  testonly = true
1075ba71b47Sopenharmony_ci  deps = []
1085ba71b47Sopenharmony_ci
1095ba71b47Sopenharmony_ci  deps += [
1105ba71b47Sopenharmony_ci    # deps file
1115ba71b47Sopenharmony_ci    ":SamgrDumperFuzzTest",
1125ba71b47Sopenharmony_ci  ]
1135ba71b47Sopenharmony_ci}
114