1# Copyright (c) 2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14#####################hydra-fuzz###################
15import("//build/config/features.gni")
16import("//build/test.gni")
17import("../../../device_usage_statistics.gni")
18
19##############################fuzztest##########################################
20module_output_path = "device_usage_statistics/device_usage_statistics"
21
22config("module_private_config") {
23  include_dirs = [
24    "${usage_statistics_path}/interfaces/innerkits/include",
25    "${usage_statistics_path}/services/common/include",
26    "${usage_statistics_path}/services/packageusage/include",
27    "${usage_statistics_path}/services/packagegroup/include",
28    "${usage_statistics_path}/interfaces/kits/bundlestats/napi/include",
29    "${usage_statistics_path}/utils/include",
30    "../common",
31  ]
32}
33
34ohos_fuzztest("BundleActivePowerstateCallbackproxyFuzzTest") {
35  module_out_path = module_output_path
36  fuzz_config_file = "${usage_statistics_path}/test/fuzztest/bundleactivepowerstatecallbackproxy_fuzzer"
37  configs = [ ":module_private_config" ]
38  cflags = [
39    "-g",
40    "-O0",
41    "-Wno-unused-variable",
42    "-fno-omit-frame-pointer",
43    "-Dprivate=public",
44    "-Dprotected=public",
45  ]
46  sources = [
47    "../common/fuzztest_helper.cpp",
48    "bundleactivepowerstatecallbackproxy_fuzzer.cpp",
49  ]
50
51  deps = [ "${usage_statistics_path}:usagestatistics" ]
52
53  public_deps = [
54    "${usage_statistics_path}:usagestatservice_static",
55    "${usage_statistics_path}:usagestatsinner",
56  ]
57  external_deps = [
58    "ability_base:want",
59    "ability_runtime:app_manager",
60    "ability_runtime:wantagent_innerkits",
61    "access_token:libaccesstoken_sdk",
62    "access_token:libnativetoken",
63    "access_token:libtoken_setproc",
64    "access_token:libtokenid_sdk",
65    "bundle_framework:appexecfwk_base",
66    "bundle_framework:appexecfwk_core",
67    "c_utils:utils",
68    "common_event_service:cesfwk_innerkits",
69    "eventhandler:libeventhandler",
70    "ffrt:libffrt",
71    "hilog:libhilog",
72    "init:libbegetutil",
73    "ipc:ipc_single",
74    "relational_store:native_rdb",
75    "safwk:system_ability_fwk",
76    "samgr:samgr_proxy",
77    "time_service:time_client",
78  ]
79
80  defines = []
81
82  if (bgtaskmgr_enable) {
83    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
84    defines += [ "BGTASKMGR_ENABLE" ]
85  }
86  if (os_account_part_enabled) {
87    cflags_cc = [ "-DOS_ACCOUNT_PART_ENABLED" ]
88    external_deps += [ "os_account:os_account_innerkits" ]
89  }
90  if (device_usage_statistics_with_powermgr_power_manager_enable) {
91    defines += [ "DEVICE_USAGES_STATISTICS_POWERMANGER_ENABLE" ]
92    external_deps += [ "power_manager:powermgr_client" ]
93  }
94}
95
96###############################################################################
97group("fuzztest") {
98  testonly = true
99  deps = []
100  deps += [
101    # deps file
102    ":BundleActivePowerstateCallbackproxyFuzzTest",
103  ]
104}
105###############################################################################
106