# Copyright (c) 2022 Huawei Device Co., Ltd.
#
# HDF is dual licensed: you can use it either under the terms of
# the GPL, or the BSD license, at your option.
# See the LICENSE file in the root of this repository for complete details.

import("//build/config/features.gni")
import("//build/test.gni")
module_output_path = "hdf/hdi"

ohos_fuzztest("UnloadDeviceFuzzTest") {
  module_out_path = module_output_path

  fuzz_config_file = "//drivers/hdf_core/framework/test/fuzztest/hdimanager/unloaddevice_fuzzer"

  include_dirs = [
    "//drivers/hdf_core/framework/test/fuzztest/hdimanager/unloaddevice_fuzzer",
    "//drivers/hdf_core/adapter/uhdf2/include/hdi",
    "//drivers/hdf_core/adapter/uhdf2/osal/include",
    "//drivers/hdf_core/framework/include/utils",
    "//utils/native/base/include",
  ]
  cflags = [
    "-g",
    "-O0",
    "-Wno-unused-variable",
    "-fno-omit-frame-pointer",
  ]
  sources = [ "unloaddevice_fuzzer.cpp" ]

  deps = [
    "//drivers/hdf_core/adapter/uhdf2/hdi:libhdi",
    "//drivers/hdf_core/adapter/uhdf2/ipc:libhdf_ipc_adapter",
    "//drivers/hdf_core/adapter/uhdf2/utils:libhdf_utils",
  ]

  if (is_standard_system) {
    external_deps = [
      "hiviewdfx_hilog_native:libhilog",
      "ipc:ipc_single",
      "samgr_standard:samgr_proxy",
      "utils_base:utils",
    ]
  } else {
    external_deps = [
      "hilog:libhilog",
      "ipc:ipc_single",
      "samgr:samgr_proxy",
    ]
  }
}

group("fuzztest") {
  testonly = true
  deps = []
  deps += [ ":UnloadDeviceFuzzTest" ]
}