• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 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("//build/config/features.gni")
15import("//build/test.gni")
16
17#####################hydra-fuzz###################
18import("//foundation/arkui/ace_engine/ace_config.gni")
19module_output_path = "arkui/imageloader"
20
21##############################fuzztest##########################################
22ohos_fuzztest("ImageLoaderFuzzTest") {
23  module_out_path = module_output_path
24  fuzz_config_file =
25      "//foundation/arkui/ace_engine/test/fuzztest/imageloader_fuzzer"
26  include_dirs = []
27  cflags = [
28    "-g",
29    "-O0",
30    "-Wno-unused-variable",
31    "-fno-omit-frame-pointer",
32  ]
33  deps = [
34    "$ace_root/frameworks/base/resource:ace_resource",
35    "$ace_root/frameworks/core/components/theme:build_theme_code",
36    "$ace_root/test/unittest:ace_engine_unittest_flutter_deps",
37    "$cjson_root:cjson",
38  ]
39  sources = [
40    # base
41    "$ace_root/frameworks/base/json/json_util.cpp",
42    "$ace_root/frameworks/base/log/dump_log.cpp",
43    "$ace_root/frameworks/base/utils/base_id.cpp",
44
45    # properties
46    "$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
47    "$ace_root/frameworks/core/components/common/properties/border.cpp",
48    "$ace_root/frameworks/core/components/common/properties/border_edge.cpp",
49    "$ace_root/frameworks/core/components/common/properties/color.cpp",
50    "$ace_root/frameworks/core/components/common/properties/text_style.cpp",
51
52    # theme
53    "$ace_root/frameworks/core/components/theme/app_theme.cpp",
54    "$ace_root/frameworks/core/components/theme/theme_attributes.cpp",
55    "$ace_root/frameworks/core/components/theme/theme_constants.cpp",
56    "$ace_root/frameworks/core/components/theme/theme_utils.cpp",
57    "$root_out_dir/arkui/framework/core/components/theme/theme_constants_default.cpp",
58
59    # animation
60    "$ace_root/frameworks/core/animation/animator.cpp",
61    "$ace_root/frameworks/core/animation/anticipate_curve.cpp",
62    "$ace_root/frameworks/core/animation/cubic_curve.cpp",
63    "$ace_root/frameworks/core/animation/curves.cpp",
64    "$ace_root/frameworks/core/animation/scheduler.cpp",
65    "$ace_root/test/mock/frameworks/base/log/mock_jank_frame_report.cpp",
66
67    # common
68    "$ace_root/frameworks/base/geometry/animatable_dimension.cpp",
69    "$ace_root/frameworks/base/memory/memory_monitor.cpp",
70    "$ace_root/frameworks/core/common/ace_application_info.cpp",
71    "$ace_root/frameworks/core/common/ace_engine.cpp",
72    "$ace_root/frameworks/core/common/container.cpp",
73    "$ace_root/frameworks/core/common/container_scope.cpp",
74    "$ace_root/frameworks/core/common/frontend.cpp",
75    "$ace_root/frameworks/core/common/thread_checker.cpp",
76    "$ace_root/frameworks/core/common/window.cpp",
77
78    # event
79    "$ace_root/frameworks/core/common/test/mock/mock_watch_dog.cpp",
80    "$ace_root/frameworks/core/event/back_end_event_manager.cpp",
81
82    # mock
83    "$ace_root/frameworks/core/components_ng/test/mock/render/mock_skia_image.cpp",
84
85    #fuzz
86    "$ace_root/adapter/ohos/entrance/file_asset_provider.cpp",
87    "$ace_root/adapter/ohos/osal/system_properties.cpp",
88
89    #"$ace_root/frameworks/base/resource/ace_res_config.cpp",
90    #"$ace_root/frameworks/base/resource/ace_res_key_parser.cpp",
91    "$ace_root/frameworks/core/common/flutter/flutter_asset_manager.cpp",
92
93    #"$ace_root/frameworks/base/log/ace_trace.cpp",
94    "$ace_root/frameworks/base/thread/background_task_executor.cpp",
95    "$ace_root/frameworks/core/components/test/unittest/mock/ace_trace_mock.cpp",
96
97    #"$ace_root/frameworks/base/resource/internal_resource.cpp",
98    "$ace_root/frameworks/base/log/ace_tracker.cpp",
99    "$ace_root/frameworks/base/test/mock/mock_download_manager.cpp",
100    "$ace_root/frameworks/core/common/event_manager.cpp",
101    "$ace_root/frameworks/core/components/test/unittest/mock/event_report_mock.cpp",
102    "$ace_root/frameworks/core/components_ng/gestures/gesture_referee.cpp",
103    "$ace_root/frameworks/core/image/flutter_image_cache.cpp",
104    "$ace_root/frameworks/core/image/image_cache.cpp",
105    "$ace_root/frameworks/core/image/image_compressor.cpp",
106    "$ace_root/frameworks/core/image/image_loader.cpp",
107    "$ace_root/frameworks/core/image/image_object.cpp",
108    "$ace_root/frameworks/core/image/image_provider.cpp",
109    "$ace_root/frameworks/core/image/image_source_info.cpp",
110    "$ace_root/frameworks/core/pipeline/pipeline_base.cpp",
111    "imageloader_fuzzer.cpp",
112  ]
113
114  # add sources only needed by wearable like watch.
115  if (is_wearable_product) {
116    sources += [ "$root_out_dir/arkui/framework/core/components/theme/theme_constants_watch.cpp" ]
117  }
118
119  # add sources needed by phone and TV. wearable like watch do not need them
120  if (!is_wearable_product) {
121    sources += [
122      # theme
123      "$root_out_dir/arkui/framework/core/components/theme/theme_constants_tv.cpp",
124    ]
125  }
126
127  ldflags = []
128  if (ace_engine_feature_enable_coverage) {
129    cflags += [ "--coverage" ]
130    ldflags += [ "--coverage" ]
131  }
132
133  if (is_ohos_standard_system) {
134    external_deps = [
135      "hilog:libhilog",
136      "init:libbegetutil",
137    ]
138    deps += [ "$ace_flutter_engine_root/icu:ace_libicu_ohos" ]
139  } else {
140    external_deps = [
141      "hilog:libhilog",
142      "init_lite:libbegetutil",
143    ]
144  }
145  external_deps += [ "c_utils:utils" ]
146  sources += [
147    "$ace_root/adapter/ohos/osal/log_wrapper.cpp",
148    "$ace_root/frameworks/core/components/test/mock/mock_resource_adapter.cpp",
149  ]
150  part_name = ace_engine_part
151
152  #defined =["FUZZTEST"];
153  include_dirs = [
154    "$ace_root/frameworks/core/components/common/properties",
155    "$ace_root/frameworks/core/components/theme",
156    "$ace_root/frameworks/core/event",
157    "$ace_root/frameworks/core",
158    "$ace_root/frameworks/base/utils",
159    "$ace_root/frameworks/base",
160    "$ace_root/frameworks/base/memory",
161    "$ace_root/frameworks/base/log",
162    "$ace_root/frameworks",
163    "$ace_root",
164    "//third_party/flutter/engine/flutter/assets",
165    "//third_party/flutter/engine",
166    "//third_party",
167    "//commonlibrary/c_utils/base/include",
168    "$root_out_dir/arkui/framework",
169  ]
170  if (frame_trace_support) {
171    deps += [ "//foundation/resourceschedule/frame_aware_sched/interfaces/innerkits/frameintf:frame_trace_intf" ]
172    include_dirs += [ "//foundation/resourceschedule/frame_aware_sched/interfaces/innerkits/frameintf" ]
173    sources += [ "$ace_root/adapter/ohos/osal/frame_trace_adapter_impl.cpp" ]
174  } else {
175    sources +=
176        [ "$ace_root/adapter/ohos/osal/frame_trace_adapter_fake_impl.cpp" ]
177  }
178}
179
180###############################################################################
181group("fuzztest") {
182  testonly = true
183  deps = []
184  if (!is_asan) {
185    deps += [ ":ImageLoaderFuzzTest" ]
186  }
187}
188###############################################################################
189