# Copyright (c) 2022-2025 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###################
SUBSYSTEM_DIR = "../../../.."
import("//build/config/features.gni")
import("//build/ohos.gni")
import("//build/test.gni")
 
##############################fuzztest##########################################
ohos_fuzztest("SimOperationFuzzTest") {
  module_output_path = "core_service/core_service"
  module_out_path = module_output_path
  fuzz_config_file =
      "$SUBSYSTEM_DIR/core_service/test/fuzztest/simoperation_fuzzer"
 
  include_dirs = [
    "$SUBSYSTEM_DIR/core_service/frameworks/js/napi/include",
    "$SUBSYSTEM_DIR/core_service/frameworks/js/napi",
    "$SUBSYSTEM_DIR/core_service/services/sim/include",
    "$SUBSYSTEM_DIR/core_service/services/core/include",
    "$SUBSYSTEM_DIR/core_service/services/tel_ril/include",
    "$SUBSYSTEM_DIR/core_service/test/fuzztest/common_fuzzer",
    "$SUBSYSTEM_DIR/core_service/utils/common/include",
  ]
 
  configs = [ "$SUBSYSTEM_DIR/core_service/utils:telephony_log_config" ]
 
  deps = [
    "$SUBSYSTEM_DIR/core_service/test:tel_core_service_static",
    "$SUBSYSTEM_DIR/core_service/interfaces/innerkits:tel_core_service_api",
    "$SUBSYSTEM_DIR/core_service/utils:libtel_common",
  ]
 
  external_deps = [
    "ability_runtime:ability_manager",
    "access_token:libaccesstoken_sdk",
    "access_token:libnativetoken_shared",
    "access_token:libtoken_setproc",
    "config_policy:configpolicy_util",
    "cJSON:cjson",
    "drivers_interface_ril:libril_proxy_1.1",
    "data_share:datashare_consumer",
    "eventhandler:libeventhandler",
    "ffrt:libffrt",
    "hdf_core:libpub_utils",
    "hilog:libhilog",
    "ipc:ipc_single",
    "libxml2:libxml2",
    "napi:ace_napi",
    "safwk:system_ability_fwk",
    "node:node_header_notice",
  ]
  defines = [
    "TELEPHONY_LOG_TAG = \"SimOperationFuzzTest\"",
    "LOG_DOMAIN = 0xD000F00",
  ]
 
  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
    "-flto",
    "-fvisibility=hidden",
  ]
 
  sources = [
    "$SUBSYSTEM_DIR/core_service/frameworks/js/napi/napi_util.cpp",
    "$SUBSYSTEM_DIR/core_service/test/fuzztest/common_fuzzer/addcoreservicetoken_fuzzer.cpp",
    "simoperation_fuzzer.cpp",
  ]
}
 
###############################################################################
group("fuzztest") {
  testonly = true
  deps = []
  deps += [
    # deps file
    ":SimOperationFuzzTest",
  ]
}
###############################################################################