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
14import("//base/print/print_fwk/print.gni")
15import("//build/config/features.gni")
16import("//build/ohos.gni")
17import("//build/test.gni")
18
19##############################fuzztest##########################################
20ohos_fuzztest("PrintCupsClientFuzzTest") {
21  module_out_path = fuzz_test_output_path
22
23  fuzz_config_file = "${print_path}/test/fuzztest/printcupsclient_fuzzer"
24
25  include_dirs = [
26    "${print_path}/frameworks/innerkitsimpl/print_impl/include",
27    "${print_path}/frameworks/ohprint/include",
28    "${print_utils_path}/include",
29    "//vendor/open_source/cpp-httplib",
30  ]
31
32  cflags = [
33    "-g",
34    "-O0",
35    "-Wno-unused-variable",
36    "-fno-omit-frame-pointer",
37  ]
38
39  cflags_cc = []
40
41  deps = [
42    "${print_path}/etc/init:printservice.rc",
43    "${print_path}/frameworks/innerkitsimpl/print_impl:print_client",
44    "${print_path}/frameworks/kits/extension:print_extension_framework",
45    "${print_path}/frameworks/kits/extension:print_extension_module",
46    "${print_path}/frameworks/models/print_models:print_models",
47    "${print_path}/interfaces/kits/jsnapi/print_extension:printextensionability_napi",
48    "${print_path}/interfaces/kits/jsnapi/print_extensionctx:printextensioncontext_napi",
49    "${print_path}/interfaces/kits/napi/print_napi:print_napi",
50    "${print_path}/profile:print_sa_profiles",
51    "${print_path}/services/print_service:print_service",
52  ]
53
54  sources = [ "printcupsclient_fuzzer.cpp" ]
55
56  external_deps = [
57    "ability_base:base",
58    "ability_base:want",
59    "ability_base:zuri",
60    "ability_runtime:ability_manager",
61    "ability_runtime:abilitykit_native",
62    "access_token:libaccesstoken_sdk",
63    "access_token:libaccesstoken_sdk",
64    "access_token:libnativetoken",
65    "access_token:libtoken_setproc",
66    "bundle_framework:appexecfwk_base",
67    "bundle_framework:appexecfwk_core",
68    "c_utils:utils",
69    "common_event_service:cesfwk_innerkits",
70    "drivers_interface_usb:libusb_proxy_1.0",
71    "eventhandler:libeventhandler",
72    "hilog:libhilog",
73    "hisysevent:libhisysevent",
74    "init:libbegetutil",
75    "ipc:ipc_core",
76    "napi:ace_napi",
77    "os_account:os_account_innerkits",
78    "safwk:system_ability_fwk",
79    "samgr:samgr_proxy",
80    "usb_manager:usbsrv_client",
81    "wifi:wifi_sdk",
82  ]
83
84  if (cups_enable) {
85    include_dirs += [ "//third_party/cups/cups-2.4.0" ]
86    cflags_cc += [ "-DCUPS_ENABLE" ]
87    external_deps += [
88      "cJSON:cjson",
89      "cups:cups",
90      "cups-filters:cupsfilters",
91    ]
92  }
93
94  if (security_guard_enabled) {
95    external_deps += [
96      "security_guard:libsg_collect_sdk",
97      "time_service:time_client",
98    ]
99  }
100}
101
102###############################################################################
103group("fuzztest") {
104  testonly = true
105  deps = []
106  deps += [
107    # deps file
108    ":PrintCupsClientFuzzTest",
109  ]
110}
111###############################################################################
112