122c0b7e4Sopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
222c0b7e4Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
322c0b7e4Sopenharmony_ci# you may not use this file except in compliance with the License.
422c0b7e4Sopenharmony_ci# You may obtain a copy of the License at
522c0b7e4Sopenharmony_ci#
622c0b7e4Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
722c0b7e4Sopenharmony_ci#
822c0b7e4Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
922c0b7e4Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1022c0b7e4Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1122c0b7e4Sopenharmony_ci# See the License for the specific language governing permissions and
1222c0b7e4Sopenharmony_ci# limitations under the License.
1322c0b7e4Sopenharmony_ci
1422c0b7e4Sopenharmony_ci#####################hydra-fuzz###################
1522c0b7e4Sopenharmony_ciimport("//build/config/features.gni")
1622c0b7e4Sopenharmony_ciimport("//build/test.gni")
1722c0b7e4Sopenharmony_ciimport("../../../device_usage_statistics.gni")
1822c0b7e4Sopenharmony_ci
1922c0b7e4Sopenharmony_ci##############################fuzztest##########################################
2022c0b7e4Sopenharmony_cimodule_output_path = "device_usage_statistics/device_usage_statistics"
2122c0b7e4Sopenharmony_ci
2222c0b7e4Sopenharmony_ciconfig("module_private_config") {
2322c0b7e4Sopenharmony_ci  include_dirs = [
2422c0b7e4Sopenharmony_ci    "${usage_statistics_path}/interfaces/innerkits/include",
2522c0b7e4Sopenharmony_ci    "${usage_statistics_path}/services/common/include",
2622c0b7e4Sopenharmony_ci    "${usage_statistics_path}/services/packageusage/include",
2722c0b7e4Sopenharmony_ci    "${usage_statistics_path}/services/packagegroup/include",
2822c0b7e4Sopenharmony_ci    "${usage_statistics_path}/interfaces/kits/bundlestats/napi/include",
2922c0b7e4Sopenharmony_ci    "${usage_statistics_path}/utils/include",
3022c0b7e4Sopenharmony_ci    "../common",
3122c0b7e4Sopenharmony_ci  ]
3222c0b7e4Sopenharmony_ci}
3322c0b7e4Sopenharmony_ci
3422c0b7e4Sopenharmony_ciohos_fuzztest("AppgroupcallbackstubFuzzTest") {
3522c0b7e4Sopenharmony_ci  module_out_path = module_output_path
3622c0b7e4Sopenharmony_ci  fuzz_config_file =
3722c0b7e4Sopenharmony_ci      "${usage_statistics_path}/test/fuzztest/appgroupcallbackstub_fuzzer"
3822c0b7e4Sopenharmony_ci  configs = [ ":module_private_config" ]
3922c0b7e4Sopenharmony_ci  cflags = [
4022c0b7e4Sopenharmony_ci    "-g",
4122c0b7e4Sopenharmony_ci    "-O0",
4222c0b7e4Sopenharmony_ci    "-Wno-unused-variable",
4322c0b7e4Sopenharmony_ci    "-fno-omit-frame-pointer",
4422c0b7e4Sopenharmony_ci    "-Dprivate=public",
4522c0b7e4Sopenharmony_ci    "-Dprotected=public",
4622c0b7e4Sopenharmony_ci  ]
4722c0b7e4Sopenharmony_ci  sources = [
4822c0b7e4Sopenharmony_ci    "../common/fuzztest_helper.cpp",
4922c0b7e4Sopenharmony_ci    "appgroupcallbackstub_fuzzer.cpp",
5022c0b7e4Sopenharmony_ci  ]
5122c0b7e4Sopenharmony_ci
5222c0b7e4Sopenharmony_ci  public_deps = [ "${usage_statistics_path}:usagestatservice_static" ]
5322c0b7e4Sopenharmony_ci  external_deps = [
5422c0b7e4Sopenharmony_ci    "ability_base:want",
5522c0b7e4Sopenharmony_ci    "ability_runtime:app_manager",
5622c0b7e4Sopenharmony_ci    "ability_runtime:wantagent_innerkits",
5722c0b7e4Sopenharmony_ci    "access_token:libaccesstoken_sdk",
5822c0b7e4Sopenharmony_ci    "access_token:libnativetoken",
5922c0b7e4Sopenharmony_ci    "access_token:libtoken_setproc",
6022c0b7e4Sopenharmony_ci    "access_token:libtokenid_sdk",
6122c0b7e4Sopenharmony_ci    "bundle_framework:appexecfwk_base",
6222c0b7e4Sopenharmony_ci    "bundle_framework:appexecfwk_core",
6322c0b7e4Sopenharmony_ci    "c_utils:utils",
6422c0b7e4Sopenharmony_ci    "common_event_service:cesfwk_innerkits",
6522c0b7e4Sopenharmony_ci    "eventhandler:libeventhandler",
6622c0b7e4Sopenharmony_ci    "ffrt:libffrt",
6722c0b7e4Sopenharmony_ci    "hilog:libhilog",
6822c0b7e4Sopenharmony_ci    "init:libbegetutil",
6922c0b7e4Sopenharmony_ci    "ipc:ipc_single",
7022c0b7e4Sopenharmony_ci    "relational_store:native_rdb",
7122c0b7e4Sopenharmony_ci    "safwk:system_ability_fwk",
7222c0b7e4Sopenharmony_ci    "samgr:samgr_proxy",
7322c0b7e4Sopenharmony_ci    "time_service:time_client",
7422c0b7e4Sopenharmony_ci  ]
7522c0b7e4Sopenharmony_ci
7622c0b7e4Sopenharmony_ci  defines = []
7722c0b7e4Sopenharmony_ci
7822c0b7e4Sopenharmony_ci  if (bgtaskmgr_enable) {
7922c0b7e4Sopenharmony_ci    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
8022c0b7e4Sopenharmony_ci    defines += [ "BGTASKMGR_ENABLE" ]
8122c0b7e4Sopenharmony_ci  }
8222c0b7e4Sopenharmony_ci  if (os_account_part_enabled) {
8322c0b7e4Sopenharmony_ci    cflags_cc = [ "-DOS_ACCOUNT_PART_ENABLED" ]
8422c0b7e4Sopenharmony_ci    external_deps += [ "os_account:os_account_innerkits" ]
8522c0b7e4Sopenharmony_ci  }
8622c0b7e4Sopenharmony_ci  if (device_usage_statistics_with_powermgr_power_manager_enable) {
8722c0b7e4Sopenharmony_ci    defines += [ "DEVICE_USAGES_STATISTICS_POWERMANGER_ENABLE" ]
8822c0b7e4Sopenharmony_ci    external_deps += [ "power_manager:powermgr_client" ]
8922c0b7e4Sopenharmony_ci  }
9022c0b7e4Sopenharmony_ci}
9122c0b7e4Sopenharmony_ci
9222c0b7e4Sopenharmony_ci###############################################################################
9322c0b7e4Sopenharmony_cigroup("fuzztest") {
9422c0b7e4Sopenharmony_ci  testonly = true
9522c0b7e4Sopenharmony_ci  deps = []
9622c0b7e4Sopenharmony_ci  deps += [
9722c0b7e4Sopenharmony_ci    # deps file
9822c0b7e4Sopenharmony_ci    ":AppgroupcallbackstubFuzzTest",
9922c0b7e4Sopenharmony_ci  ]
10022c0b7e4Sopenharmony_ci}
10122c0b7e4Sopenharmony_ci###############################################################################
102