117fd14ceSopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
217fd14ceSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
317fd14ceSopenharmony_ci# you may not use this file except in compliance with the License.
417fd14ceSopenharmony_ci# You may obtain a copy of the License at
517fd14ceSopenharmony_ci#
617fd14ceSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
717fd14ceSopenharmony_ci#
817fd14ceSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
917fd14ceSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1017fd14ceSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1117fd14ceSopenharmony_ci# See the License for the specific language governing permissions and
1217fd14ceSopenharmony_ci# limitations under the License.
1317fd14ceSopenharmony_ci
1417fd14ceSopenharmony_ciimport("//base/security/device_auth/deps_adapter/deviceauth_hals.gni")
1517fd14ceSopenharmony_ciimport("//base/security/device_auth/services/deviceauth.gni")
1617fd14ceSopenharmony_ci
1717fd14ceSopenharmony_ci#####################hydra-fuzz###################
1817fd14ceSopenharmony_ciimport("//build/config/features.gni")
1917fd14ceSopenharmony_ciimport("//build/ohos.gni")
2017fd14ceSopenharmony_ciimport("//build/test.gni")
2117fd14ceSopenharmony_cimodule_output_path = "device_auth/device_auth"
2217fd14ceSopenharmony_ci
2317fd14ceSopenharmony_ci##############################fuzztest##########################################
2417fd14ceSopenharmony_ciohos_fuzztest("DevAuthCbFuzzTest") {
2517fd14ceSopenharmony_ci  module_out_path = module_output_path
2617fd14ceSopenharmony_ci  fuzz_config_file = "${deviceauth_path}/test/fuzztest/devauthcb_fuzzer"
2717fd14ceSopenharmony_ci  include_dirs = inc_path + hals_inc_path
2817fd14ceSopenharmony_ci  include_dirs += [
2917fd14ceSopenharmony_ci    ".",
3017fd14ceSopenharmony_ci    "${frameworks_path}/inc/standard",
3117fd14ceSopenharmony_ci    "${dev_frameworks_path}/inc/hiview_adapter",
3217fd14ceSopenharmony_ci    "${dev_frameworks_path}/inc/permission_adapter",
3317fd14ceSopenharmony_ci  ]
3417fd14ceSopenharmony_ci  sources = [ "devauthcb_fuzzer.cpp" ]
3517fd14ceSopenharmony_ci  sources += deviceauth_ipc_files
3617fd14ceSopenharmony_ci  sources += permission_adapter_files
3717fd14ceSopenharmony_ci  sources += [ "${frameworks_path}/src/ipc_service.c" ]
3817fd14ceSopenharmony_ci  defines = [ "HILOG_ENABLE" ]
3917fd14ceSopenharmony_ci  defines += [ "DEV_AUTH_HIVIEW_ENABLE" ]
4017fd14ceSopenharmony_ci  defines += [ "DEV_AUTH_FUZZ_TEST" ]
4117fd14ceSopenharmony_ci  cflags = [
4217fd14ceSopenharmony_ci    "-g",
4317fd14ceSopenharmony_ci    "-O0",
4417fd14ceSopenharmony_ci    "-Wno-unused-variable",
4517fd14ceSopenharmony_ci    "-fno-omit-frame-pointer",
4617fd14ceSopenharmony_ci    "-DHILOG_ENABLE",
4717fd14ceSopenharmony_ci  ]
4817fd14ceSopenharmony_ci  cflags += build_flags
4917fd14ceSopenharmony_ci  if (target_cpu == "arm") {
5017fd14ceSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
5117fd14ceSopenharmony_ci  }
5217fd14ceSopenharmony_ci  deps = [
5317fd14ceSopenharmony_ci    "${deps_adapter_path}:${hal_module_test_name}",
5417fd14ceSopenharmony_ci    "${services_path}:deviceauth",
5517fd14ceSopenharmony_ci  ]
5617fd14ceSopenharmony_ci  external_deps = [
5717fd14ceSopenharmony_ci    "access_token:libaccesstoken_sdk",
5817fd14ceSopenharmony_ci    "access_token:libnativetoken",
5917fd14ceSopenharmony_ci    "access_token:libtoken_setproc",
6017fd14ceSopenharmony_ci    "cJSON:cjson",
6117fd14ceSopenharmony_ci    "c_utils:utils",
6217fd14ceSopenharmony_ci    "hilog:libhilog",
6317fd14ceSopenharmony_ci    "hisysevent:libhisysevent",
6417fd14ceSopenharmony_ci    "hitrace:hitrace_meter",
6517fd14ceSopenharmony_ci    "init:libbegetutil",
6617fd14ceSopenharmony_ci    "ipc:ipc_core",
6717fd14ceSopenharmony_ci    "samgr:samgr_proxy",
6817fd14ceSopenharmony_ci  ]
6917fd14ceSopenharmony_ci}
7017fd14ceSopenharmony_ci
7117fd14ceSopenharmony_ci###############################################################################
7217fd14ceSopenharmony_cigroup("fuzztest") {
7317fd14ceSopenharmony_ci  testonly = true
7417fd14ceSopenharmony_ci  deps = []
7517fd14ceSopenharmony_ci  deps += [
7617fd14ceSopenharmony_ci    # deps file
7717fd14ceSopenharmony_ci    ":DevAuthCbFuzzTest",
7817fd14ceSopenharmony_ci  ]
7917fd14ceSopenharmony_ci}
8017fd14ceSopenharmony_ci###############################################################################
81