• 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/ohos.gni")
16import("//build/test.gni")
17
18#####################hydra-fuzz###################
19import("../../../screenlock.gni")
20
21##############################fuzztest##########################################
22screenlockisdisabled_test = {
23  targetName = "ScreenlockIsdisabledFuzzTest"
24  configFuzzer = "screenlockisdisabled_fuzzer"
25  source = "screenlockisdisabled_fuzzer/screenlockisdisabled_fuzzer.cpp"
26}
27screenlocksetdisabled_test = {
28  targetName = "ScreenlockSetdisabledFuzzTest"
29  configFuzzer = "screenlocksetdisabled_fuzzer"
30  source = "screenlocksetdisabled_fuzzer/screenlocksetdisabled_fuzzer.cpp"
31}
32screenlocksetauthstate_test = {
33  targetName = "ScreenlockSetAuthstateFuzzTest"
34  configFuzzer = "screenlocksetauthstate_fuzzer"
35  source = "screenlocksetauthstate_fuzzer/screenlocksetauthstate_fuzzer.cpp"
36}
37screenlockgetauthstate_test = {
38  targetName = "ScreenlockGetAuthstateFuzzTest"
39  configFuzzer = "screenlockgetauthstate_fuzzer"
40  source = "screenlockgetauthstate_fuzzer/screenlockgetauthstate_fuzzer.cpp"
41}
42screenlockrequeststrong_test = {
43  targetName = "ScreenlockRequestStrongFuzzTest"
44  configFuzzer = "screenlockrequeststrong_fuzzer"
45  source = "screenlockrequeststrong_fuzzer/screenlockrequeststrong_fuzzer.cpp"
46}
47screenlockgetstrongstate_test = {
48  targetName = "ScreenlockGetStrongStateFuzzTest"
49  configFuzzer = "screenlockgetstrongstate_fuzzer"
50  source = "screenlockgetstrongstate_fuzzer/screenlockgetstrongstate_fuzzer.cpp"
51}
52screenlockutils_test = {
53  targetName = "ScreenlockUtilsFuzzTest"
54  configFuzzer = "screenlockutils_fuzzer"
55  source = "screenlockutils_fuzzer/screenlockutils_fuzzer.cpp"
56}
57screenlockauthmanager_test = {
58  targetName = "ScreenlockAuthManagerFuzzTest"
59  configFuzzer = "screenlockauthmanager_fuzzer"
60  source = "screenlockauthmanager_fuzzer/screenlockauthmanager_fuzzer.cpp"
61}
62screenlockislocked_test = {
63  targetName = "ScreenlockIslockedFuzzTest"
64  configFuzzer = "screenlockislocked_fuzzer"
65  source = "screenlockislocked_fuzzer/screenlockislocked_fuzzer.cpp"
66}
67screenlockboundarycode_test = {
68  targetName = "ScreenlockBoundaryCodeFuzzTest"
69  configFuzzer = "screenlockboundarycode_fuzzer"
70  source = "screenlockboundarycode_fuzzer/screenlockboundarycode_fuzzer.cpp"
71}
72screenlockdump_test = {
73  targetName = "ScreenlockDumpFuzzTest"
74  configFuzzer = "screenlockdump_fuzzer"
75  source = "screenlockdump_fuzzer/screenlockdump_fuzzer.cpp"
76}
77screenlockisscreenlocked_test = {
78  targetName = "ScreenlockIsScreenlockedFuzzTest"
79  configFuzzer = "screenlockisscreenlocked_fuzzer"
80  source = "screenlockisscreenlocked_fuzzer/screenlockisscreenlocked_fuzzer.cpp"
81}
82screenlockissecuremode_test = {
83  targetName = "ScreenlockIsSecureModeFuzzTest"
84  configFuzzer = "screenlockissecuremode_fuzzer"
85  source = "screenlockissecuremode_fuzzer/screenlockissecuremode_fuzzer.cpp"
86}
87screenlocklock_test = {
88  targetName = "ScreenlockLockFuzzTest"
89  configFuzzer = "screenlocklock_fuzzer"
90  source = "screenlocklock_fuzzer/screenlocklock_fuzzer.cpp"
91}
92screenlockonsystemevent_test = {
93  targetName = "ScreenlockOnSystemEventFuzzTest"
94  configFuzzer = "screenlockonsystemevent_fuzzer"
95  source = "screenlockonsystemevent_fuzzer/screenlockonsystemevent_fuzzer.cpp"
96}
97screenlocksendscreenlockevent_test = {
98  targetName = "ScreenlockSendScreenlockEventFuzzTest"
99  configFuzzer = "screenlocksendscreenlockevent_fuzzer"
100  source = "screenlocksendscreenlockevent_fuzzer/screenlocksendscreenlockevent_fuzzer.cpp"
101}
102screenlockunlockscreen_test = {
103  targetName = "ScreenlockUnlockScreenFuzzTest"
104  configFuzzer = "screenlockunlockscreen_fuzzer"
105  source = "screenlockunlockscreen_fuzzer/screenlockunlockscreen_fuzzer.cpp"
106}
107screenlockunlock_test = {
108  targetName = "ScreenlockUnlockFuzzTest"
109  configFuzzer = "screenlockunlock_fuzzer"
110  source = "screenlockunlock_fuzzer/screenlockunlock_fuzzer.cpp"
111}
112screenlocklockscreen_test = {
113  targetName = "ScreenlockLockScreenFuzzTest"
114  configFuzzer = "screenlocklockscreen_fuzzer"
115  source = "screenlocklockscreen_fuzzer/screenlocklockscreen_fuzzer.cpp"
116}
117
118screenlock_fuzztests = [
119  screenlockauthmanager_test,
120  screenlockisdisabled_test,
121  screenlocksetdisabled_test,
122  screenlocksetauthstate_test,
123  screenlockgetauthstate_test,
124  screenlockrequeststrong_test,
125  screenlockgetstrongstate_test,
126  screenlockutils_test,
127  screenlockislocked_test,
128  screenlockboundarycode_test,
129  screenlockdump_test,
130  screenlockisscreenlocked_test,
131  screenlockissecuremode_test,
132  screenlocklock_test,
133  screenlockonsystemevent_test,
134  screenlocksendscreenlockevent_test,
135  screenlockunlockscreen_test,
136  screenlockunlock_test,
137  screenlocklockscreen_test,
138]
139
140foreach(item, screenlock_fuzztests) {
141  ohos_fuzztest(item.targetName) {
142    module_out_path = "screenlock_mgr/screenlock_mgr"
143
144    fuzz_config_file = "${screenlock_mgr_path}/test/fuzztest/screenlockservice_fuzzer/${item.configFuzzer}"
145
146    include_dirs = [
147      "${screenlock_mgr_path}/frameworks/js/napi/include",
148      "${screenlock_mgr_path}/services/include",
149      "${screenlock_mgr_path}/test/fuzztest/screenlockservice_fuzzer/common",
150    ]
151
152    cflags = [
153      "-g",
154      "-O0",
155      "-Wno-unused-variable",
156      "-fno-omit-frame-pointer",
157    ]
158
159    if (screenlock_mgr_so_crop == true) {
160      cflags += [ "-DIS_SO_CROP_H" ]
161    }
162
163    deps = [
164      "${screenlock_mgr_path}/frameworks/js/napi:screenlock_static",
165      "${screenlock_mgr_path}/interfaces/inner_api:screenlock_client_static",
166      "${screenlock_mgr_path}/services:screenlock_server_static",
167    ]
168
169    external_deps = [
170      "ability_base:want",
171      "ability_runtime:ability_manager",
172      "access_token:libaccesstoken_sdk",
173      "access_token:libtokenid_sdk",
174      "c_utils:utils",
175      "ffrt:libffrt",
176      "hilog:libhilog",
177      "ipc:ipc_single",
178      "napi:ace_napi",
179      "os_account:os_account_innerkits",
180      "preferences:native_preferences",
181      "time_service:time_client",
182      "user_auth_framework:userauth_client",
183      "window_manager:libdm",
184    ]
185
186    sources = [
187      "common/screenlock_service_fuzz_utils.cpp",
188      item.source,
189    ]
190  }
191}
192
193###############################################################################
194group("fuzztest") {
195  testonly = true
196  deps = []
197  deps += [
198    # deps file
199    ":ScreenlockAuthManagerFuzzTest",
200    ":ScreenlockBoundaryCodeFuzzTest",
201    ":ScreenlockDumpFuzzTest",
202    ":ScreenlockGetAuthstateFuzzTest",
203    ":ScreenlockGetStrongStateFuzzTest",
204    ":ScreenlockIsScreenlockedFuzzTest",
205    ":ScreenlockIsSecureModeFuzzTest",
206    ":ScreenlockIsdisabledFuzzTest",
207    ":ScreenlockIslockedFuzzTest",
208    ":ScreenlockLockFuzzTest",
209    ":ScreenlockLockScreenFuzzTest",
210    ":ScreenlockOnSystemEventFuzzTest",
211    ":ScreenlockRequestStrongFuzzTest",
212    ":ScreenlockSendScreenlockEventFuzzTest",
213    ":ScreenlockSetAuthstateFuzzTest",
214    ":ScreenlockSetdisabledFuzzTest",
215    ":ScreenlockUnlockFuzzTest",
216    ":ScreenlockUnlockScreenFuzzTest",
217    ":ScreenlockUtilsFuzzTest",
218  ]
219}
220###############################################################################
221