1365d9939Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
2365d9939Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3365d9939Sopenharmony_ci# you may not use this file except in compliance with the License.
4365d9939Sopenharmony_ci# You may obtain a copy of the License at
5365d9939Sopenharmony_ci#
6365d9939Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7365d9939Sopenharmony_ci#
8365d9939Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9365d9939Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10365d9939Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11365d9939Sopenharmony_ci# See the License for the specific language governing permissions and
12365d9939Sopenharmony_ci# limitations under the License.
13365d9939Sopenharmony_ci
14365d9939Sopenharmony_ciimport("//build/config/features.gni")
15365d9939Sopenharmony_ciimport("//build/ohos.gni")
16365d9939Sopenharmony_ciimport("//build/test.gni")
17365d9939Sopenharmony_ci
18365d9939Sopenharmony_ci#####################hydra-fuzz###################
19365d9939Sopenharmony_ciimport("../../../screenlock.gni")
20365d9939Sopenharmony_ci
21365d9939Sopenharmony_ci##############################fuzztest##########################################
22365d9939Sopenharmony_ciscreenlockisdisabled_test = {
23365d9939Sopenharmony_ci  targetName = "ScreenlockIsdisabledFuzzTest"
24365d9939Sopenharmony_ci  configFuzzer = "screenlockisdisabled_fuzzer"
25365d9939Sopenharmony_ci  source = "screenlockisdisabled_fuzzer/screenlockisdisabled_fuzzer.cpp"
26365d9939Sopenharmony_ci}
27365d9939Sopenharmony_ciscreenlocksetdisabled_test = {
28365d9939Sopenharmony_ci  targetName = "ScreenlockSetdisabledFuzzTest"
29365d9939Sopenharmony_ci  configFuzzer = "screenlocksetdisabled_fuzzer"
30365d9939Sopenharmony_ci  source = "screenlocksetdisabled_fuzzer/screenlocksetdisabled_fuzzer.cpp"
31365d9939Sopenharmony_ci}
32365d9939Sopenharmony_ciscreenlocksetauthstate_test = {
33365d9939Sopenharmony_ci  targetName = "ScreenlockSetAuthstateFuzzTest"
34365d9939Sopenharmony_ci  configFuzzer = "screenlocksetauthstate_fuzzer"
35365d9939Sopenharmony_ci  source = "screenlocksetauthstate_fuzzer/screenlocksetauthstate_fuzzer.cpp"
36365d9939Sopenharmony_ci}
37365d9939Sopenharmony_ciscreenlockgetauthstate_test = {
38365d9939Sopenharmony_ci  targetName = "ScreenlockGetAuthstateFuzzTest"
39365d9939Sopenharmony_ci  configFuzzer = "screenlockgetauthstate_fuzzer"
40365d9939Sopenharmony_ci  source = "screenlockgetauthstate_fuzzer/screenlockgetauthstate_fuzzer.cpp"
41365d9939Sopenharmony_ci}
42365d9939Sopenharmony_ciscreenlockrequeststrong_test = {
43365d9939Sopenharmony_ci  targetName = "ScreenlockRequestStrongFuzzTest"
44365d9939Sopenharmony_ci  configFuzzer = "screenlockrequeststrong_fuzzer"
45365d9939Sopenharmony_ci  source = "screenlockrequeststrong_fuzzer/screenlockrequeststrong_fuzzer.cpp"
46365d9939Sopenharmony_ci}
47365d9939Sopenharmony_ciscreenlockgetstrongstate_test = {
48365d9939Sopenharmony_ci  targetName = "ScreenlockGetStrongStateFuzzTest"
49365d9939Sopenharmony_ci  configFuzzer = "screenlockgetstrongstate_fuzzer"
50365d9939Sopenharmony_ci  source = "screenlockgetstrongstate_fuzzer/screenlockgetstrongstate_fuzzer.cpp"
51365d9939Sopenharmony_ci}
52365d9939Sopenharmony_ciscreenlockutils_test = {
53365d9939Sopenharmony_ci  targetName = "ScreenlockUtilsFuzzTest"
54365d9939Sopenharmony_ci  configFuzzer = "screenlockutils_fuzzer"
55365d9939Sopenharmony_ci  source = "screenlockutils_fuzzer/screenlockutils_fuzzer.cpp"
56365d9939Sopenharmony_ci}
57365d9939Sopenharmony_ciscreenlockauthmanager_test = {
58365d9939Sopenharmony_ci  targetName = "ScreenlockAuthManagerFuzzTest"
59365d9939Sopenharmony_ci  configFuzzer = "screenlockauthmanager_fuzzer"
60365d9939Sopenharmony_ci  source = "screenlockauthmanager_fuzzer/screenlockauthmanager_fuzzer.cpp"
61365d9939Sopenharmony_ci}
62365d9939Sopenharmony_ciscreenlockislocked_test = {
63365d9939Sopenharmony_ci  targetName = "ScreenlockIslockedFuzzTest"
64365d9939Sopenharmony_ci  configFuzzer = "screenlockislocked_fuzzer"
65365d9939Sopenharmony_ci  source = "screenlockislocked_fuzzer/screenlockislocked_fuzzer.cpp"
66365d9939Sopenharmony_ci}
67365d9939Sopenharmony_ciscreenlockboundarycode_test = {
68365d9939Sopenharmony_ci  targetName = "ScreenlockBoundaryCodeFuzzTest"
69365d9939Sopenharmony_ci  configFuzzer = "screenlockboundarycode_fuzzer"
70365d9939Sopenharmony_ci  source = "screenlockboundarycode_fuzzer/screenlockboundarycode_fuzzer.cpp"
71365d9939Sopenharmony_ci}
72365d9939Sopenharmony_ciscreenlockdump_test = {
73365d9939Sopenharmony_ci  targetName = "ScreenlockDumpFuzzTest"
74365d9939Sopenharmony_ci  configFuzzer = "screenlockdump_fuzzer"
75365d9939Sopenharmony_ci  source = "screenlockdump_fuzzer/screenlockdump_fuzzer.cpp"
76365d9939Sopenharmony_ci}
77365d9939Sopenharmony_ciscreenlockisscreenlocked_test = {
78365d9939Sopenharmony_ci  targetName = "ScreenlockIsScreenlockedFuzzTest"
79365d9939Sopenharmony_ci  configFuzzer = "screenlockisscreenlocked_fuzzer"
80365d9939Sopenharmony_ci  source = "screenlockisscreenlocked_fuzzer/screenlockisscreenlocked_fuzzer.cpp"
81365d9939Sopenharmony_ci}
82365d9939Sopenharmony_ciscreenlockissecuremode_test = {
83365d9939Sopenharmony_ci  targetName = "ScreenlockIsSecureModeFuzzTest"
84365d9939Sopenharmony_ci  configFuzzer = "screenlockissecuremode_fuzzer"
85365d9939Sopenharmony_ci  source = "screenlockissecuremode_fuzzer/screenlockissecuremode_fuzzer.cpp"
86365d9939Sopenharmony_ci}
87365d9939Sopenharmony_ciscreenlocklock_test = {
88365d9939Sopenharmony_ci  targetName = "ScreenlockLockFuzzTest"
89365d9939Sopenharmony_ci  configFuzzer = "screenlocklock_fuzzer"
90365d9939Sopenharmony_ci  source = "screenlocklock_fuzzer/screenlocklock_fuzzer.cpp"
91365d9939Sopenharmony_ci}
92365d9939Sopenharmony_ciscreenlockonsystemevent_test = {
93365d9939Sopenharmony_ci  targetName = "ScreenlockOnSystemEventFuzzTest"
94365d9939Sopenharmony_ci  configFuzzer = "screenlockonsystemevent_fuzzer"
95365d9939Sopenharmony_ci  source = "screenlockonsystemevent_fuzzer/screenlockonsystemevent_fuzzer.cpp"
96365d9939Sopenharmony_ci}
97365d9939Sopenharmony_ciscreenlocksendscreenlockevent_test = {
98365d9939Sopenharmony_ci  targetName = "ScreenlockSendScreenlockEventFuzzTest"
99365d9939Sopenharmony_ci  configFuzzer = "screenlocksendscreenlockevent_fuzzer"
100365d9939Sopenharmony_ci  source = "screenlocksendscreenlockevent_fuzzer/screenlocksendscreenlockevent_fuzzer.cpp"
101365d9939Sopenharmony_ci}
102365d9939Sopenharmony_ciscreenlockunlockscreen_test = {
103365d9939Sopenharmony_ci  targetName = "ScreenlockUnlockScreenFuzzTest"
104365d9939Sopenharmony_ci  configFuzzer = "screenlockunlockscreen_fuzzer"
105365d9939Sopenharmony_ci  source = "screenlockunlockscreen_fuzzer/screenlockunlockscreen_fuzzer.cpp"
106365d9939Sopenharmony_ci}
107365d9939Sopenharmony_ciscreenlockunlock_test = {
108365d9939Sopenharmony_ci  targetName = "ScreenlockUnlockFuzzTest"
109365d9939Sopenharmony_ci  configFuzzer = "screenlockunlock_fuzzer"
110365d9939Sopenharmony_ci  source = "screenlockunlock_fuzzer/screenlockunlock_fuzzer.cpp"
111365d9939Sopenharmony_ci}
112365d9939Sopenharmony_ciscreenlocklockscreen_test = {
113365d9939Sopenharmony_ci  targetName = "ScreenlockLockScreenFuzzTest"
114365d9939Sopenharmony_ci  configFuzzer = "screenlocklockscreen_fuzzer"
115365d9939Sopenharmony_ci  source = "screenlocklockscreen_fuzzer/screenlocklockscreen_fuzzer.cpp"
116365d9939Sopenharmony_ci}
117365d9939Sopenharmony_ci
118365d9939Sopenharmony_ciscreenlock_fuzztests = [
119365d9939Sopenharmony_ci  screenlockauthmanager_test,
120365d9939Sopenharmony_ci  screenlockisdisabled_test,
121365d9939Sopenharmony_ci  screenlocksetdisabled_test,
122365d9939Sopenharmony_ci  screenlocksetauthstate_test,
123365d9939Sopenharmony_ci  screenlockgetauthstate_test,
124365d9939Sopenharmony_ci  screenlockrequeststrong_test,
125365d9939Sopenharmony_ci  screenlockgetstrongstate_test,
126365d9939Sopenharmony_ci  screenlockutils_test,
127365d9939Sopenharmony_ci  screenlockislocked_test,
128365d9939Sopenharmony_ci  screenlockboundarycode_test,
129365d9939Sopenharmony_ci  screenlockdump_test,
130365d9939Sopenharmony_ci  screenlockisscreenlocked_test,
131365d9939Sopenharmony_ci  screenlockissecuremode_test,
132365d9939Sopenharmony_ci  screenlocklock_test,
133365d9939Sopenharmony_ci  screenlockonsystemevent_test,
134365d9939Sopenharmony_ci  screenlocksendscreenlockevent_test,
135365d9939Sopenharmony_ci  screenlockunlockscreen_test,
136365d9939Sopenharmony_ci  screenlockunlock_test,
137365d9939Sopenharmony_ci  screenlocklockscreen_test,
138365d9939Sopenharmony_ci]
139365d9939Sopenharmony_ci
140365d9939Sopenharmony_ciforeach(item, screenlock_fuzztests) {
141365d9939Sopenharmony_ci  ohos_fuzztest(item.targetName) {
142365d9939Sopenharmony_ci    module_out_path = "screenlock_mgr/screenlock_mgr"
143365d9939Sopenharmony_ci
144365d9939Sopenharmony_ci    fuzz_config_file = "${screenlock_mgr_path}/test/fuzztest/screenlockservice_fuzzer/${item.configFuzzer}"
145365d9939Sopenharmony_ci
146365d9939Sopenharmony_ci    include_dirs = [
147365d9939Sopenharmony_ci      "${screenlock_mgr_path}/frameworks/js/napi/include",
148365d9939Sopenharmony_ci      "${screenlock_mgr_path}/services/include",
149365d9939Sopenharmony_ci      "${screenlock_mgr_path}/utils/include",
150365d9939Sopenharmony_ci      "${screenlock_mgr_path}/test/fuzztest/screenlockservice_fuzzer/common",
151365d9939Sopenharmony_ci    ]
152365d9939Sopenharmony_ci
153365d9939Sopenharmony_ci    cflags = [
154365d9939Sopenharmony_ci      "-g",
155365d9939Sopenharmony_ci      "-O0",
156365d9939Sopenharmony_ci      "-Wno-unused-variable",
157365d9939Sopenharmony_ci      "-fno-omit-frame-pointer",
158365d9939Sopenharmony_ci    ]
159365d9939Sopenharmony_ci
160365d9939Sopenharmony_ci    deps = [
161365d9939Sopenharmony_ci      "${screenlock_mgr_path}/frameworks/js/napi:screenlock_static",
162365d9939Sopenharmony_ci      "${screenlock_mgr_path}/interfaces/inner_api:screenlock_client_static",
163365d9939Sopenharmony_ci      "${screenlock_mgr_path}/services:screenlock_server_static",
164365d9939Sopenharmony_ci      "${screenlock_mgr_path}/utils:screenlock_utils",
165365d9939Sopenharmony_ci    ]
166365d9939Sopenharmony_ci
167365d9939Sopenharmony_ci    external_deps = [
168365d9939Sopenharmony_ci      "ability_base:want",
169365d9939Sopenharmony_ci      "ability_runtime:ability_manager",
170365d9939Sopenharmony_ci      "access_token:libaccesstoken_sdk",
171365d9939Sopenharmony_ci      "access_token:libtokenid_sdk",
172365d9939Sopenharmony_ci      "c_utils:utils",
173365d9939Sopenharmony_ci      "ffrt:libffrt",
174365d9939Sopenharmony_ci      "hilog:libhilog",
175365d9939Sopenharmony_ci      "ipc:ipc_single",
176365d9939Sopenharmony_ci      "napi:ace_napi",
177365d9939Sopenharmony_ci      "os_account:os_account_innerkits",
178365d9939Sopenharmony_ci      "preferences:native_preferences",
179365d9939Sopenharmony_ci      "time_service:time_client",
180365d9939Sopenharmony_ci      "user_auth_framework:userauth_client",
181365d9939Sopenharmony_ci      "window_manager:libdm",
182365d9939Sopenharmony_ci    ]
183365d9939Sopenharmony_ci
184365d9939Sopenharmony_ci    sources = [
185365d9939Sopenharmony_ci      "common/screenlock_service_fuzz_utils.cpp",
186365d9939Sopenharmony_ci      item.source,
187365d9939Sopenharmony_ci    ]
188365d9939Sopenharmony_ci  }
189365d9939Sopenharmony_ci}
190365d9939Sopenharmony_ci
191365d9939Sopenharmony_ci###############################################################################
192365d9939Sopenharmony_cigroup("fuzztest") {
193365d9939Sopenharmony_ci  testonly = true
194365d9939Sopenharmony_ci  deps = []
195365d9939Sopenharmony_ci  deps += [
196365d9939Sopenharmony_ci    # deps file
197365d9939Sopenharmony_ci    ":ScreenlockAuthManagerFuzzTest",
198365d9939Sopenharmony_ci    ":ScreenlockBoundaryCodeFuzzTest",
199365d9939Sopenharmony_ci    ":ScreenlockDumpFuzzTest",
200365d9939Sopenharmony_ci    ":ScreenlockGetAuthstateFuzzTest",
201365d9939Sopenharmony_ci    ":ScreenlockGetStrongStateFuzzTest",
202365d9939Sopenharmony_ci    ":ScreenlockIsScreenlockedFuzzTest",
203365d9939Sopenharmony_ci    ":ScreenlockIsSecureModeFuzzTest",
204365d9939Sopenharmony_ci    ":ScreenlockIsdisabledFuzzTest",
205365d9939Sopenharmony_ci    ":ScreenlockIslockedFuzzTest",
206365d9939Sopenharmony_ci    ":ScreenlockLockFuzzTest",
207365d9939Sopenharmony_ci    ":ScreenlockLockScreenFuzzTest",
208365d9939Sopenharmony_ci    ":ScreenlockOnSystemEventFuzzTest",
209365d9939Sopenharmony_ci    ":ScreenlockRequestStrongFuzzTest",
210365d9939Sopenharmony_ci    ":ScreenlockSendScreenlockEventFuzzTest",
211365d9939Sopenharmony_ci    ":ScreenlockSetAuthstateFuzzTest",
212365d9939Sopenharmony_ci    ":ScreenlockSetdisabledFuzzTest",
213365d9939Sopenharmony_ci    ":ScreenlockUnlockFuzzTest",
214365d9939Sopenharmony_ci    ":ScreenlockUnlockScreenFuzzTest",
215365d9939Sopenharmony_ci    ":ScreenlockUtilsFuzzTest",
216365d9939Sopenharmony_ci  ]
217365d9939Sopenharmony_ci}
218365d9939Sopenharmony_ci###############################################################################
219