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("IsoFuzzTest") {
2517fd14ceSopenharmony_ci  module_out_path = module_output_path
2617fd14ceSopenharmony_ci  fuzz_config_file = "${deviceauth_path}/test/fuzztest/protocol/iso_fuzzer"
2717fd14ceSopenharmony_ci  include_dirs = inc_path + hals_inc_path
2817fd14ceSopenharmony_ci  include_dirs += [
2917fd14ceSopenharmony_ci    ".",
3017fd14ceSopenharmony_ci    "${inner_api_path}",
3117fd14ceSopenharmony_ci    "${frameworks_path}/inc/standard",
3217fd14ceSopenharmony_ci    "${dev_frameworks_path}/inc/hiview_adapter",
3317fd14ceSopenharmony_ci    "${dev_frameworks_path}/inc/permission_adapter",
3417fd14ceSopenharmony_ci    "${dev_frameworks_path}/inc",
3517fd14ceSopenharmony_ci    "${session_manager_path}/inc/session/v2/auth_sub_session/protocol_lib",
3617fd14ceSopenharmony_ci  ]
3717fd14ceSopenharmony_ci  sources = [ "iso_fuzzer.cpp" ]
3817fd14ceSopenharmony_ci  sources += deviceauth_ipc_files
3917fd14ceSopenharmony_ci  sources += permission_adapter_files
4017fd14ceSopenharmony_ci  sources += [ "${frameworks_path}/src/ipc_service.c" ]
4117fd14ceSopenharmony_ci  sources += iso_protocol_files
4217fd14ceSopenharmony_ci  sources += hiview_adapter_files
4317fd14ceSopenharmony_ci
4417fd14ceSopenharmony_ci  defines = [ "ENABLE_ISO" ]
4517fd14ceSopenharmony_ci  defines += [ "HILOG_ENABLE" ]
4617fd14ceSopenharmony_ci  defines += [ "DEV_AUTH_HIVIEW_ENABLE" ]
4717fd14ceSopenharmony_ci  defines += [ "DEV_AUTH_FUZZ_TEST" ]
4817fd14ceSopenharmony_ci  cflags = [
4917fd14ceSopenharmony_ci    "-g",
5017fd14ceSopenharmony_ci    "-O0",
5117fd14ceSopenharmony_ci    "-Wno-unused-variable",
5217fd14ceSopenharmony_ci    "-fno-omit-frame-pointer",
5317fd14ceSopenharmony_ci    "-DHILOG_ENABLE",
5417fd14ceSopenharmony_ci  ]
5517fd14ceSopenharmony_ci  cflags += build_flags
5617fd14ceSopenharmony_ci  if (target_cpu == "arm") {
5717fd14ceSopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
5817fd14ceSopenharmony_ci  }
5917fd14ceSopenharmony_ci  deps = [ "${deps_adapter_path}:${hal_module_test_name}" ]
6017fd14ceSopenharmony_ci  external_deps = [
6117fd14ceSopenharmony_ci    "access_token:libaccesstoken_sdk",
6217fd14ceSopenharmony_ci    "access_token:libnativetoken",
6317fd14ceSopenharmony_ci    "access_token:libtoken_setproc",
6417fd14ceSopenharmony_ci    "cJSON:cjson",
6517fd14ceSopenharmony_ci    "c_utils:utils",
6617fd14ceSopenharmony_ci    "hilog:libhilog",
6717fd14ceSopenharmony_ci    "hisysevent:libhisysevent",
6817fd14ceSopenharmony_ci    "hitrace:hitrace_meter",
6917fd14ceSopenharmony_ci    "huks:libhukssdk",
7017fd14ceSopenharmony_ci    "init:libbegetutil",
7117fd14ceSopenharmony_ci    "ipc:ipc_core",
7217fd14ceSopenharmony_ci    "samgr:samgr_proxy",
7317fd14ceSopenharmony_ci  ]
7417fd14ceSopenharmony_ci}
7517fd14ceSopenharmony_ci
7617fd14ceSopenharmony_ci###############################################################################
7717fd14ceSopenharmony_cigroup("fuzztest") {
7817fd14ceSopenharmony_ci  testonly = true
7917fd14ceSopenharmony_ci  deps = []
8017fd14ceSopenharmony_ci  deps += [
8117fd14ceSopenharmony_ci    # deps file
8217fd14ceSopenharmony_ci    ":IsoFuzzTest",
8317fd14ceSopenharmony_ci  ]
8417fd14ceSopenharmony_ci}
8517fd14ceSopenharmony_ci###############################################################################
86