181b96c26Sopenharmony_ci# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
281b96c26Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
381b96c26Sopenharmony_ci# you may not use this file except in compliance with the License.
481b96c26Sopenharmony_ci# You may obtain a copy of the License at
581b96c26Sopenharmony_ci#
681b96c26Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
781b96c26Sopenharmony_ci#
881b96c26Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
981b96c26Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1081b96c26Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1181b96c26Sopenharmony_ci# See the License for the specific language governing permissions and
1281b96c26Sopenharmony_ci# limitations under the License.
1381b96c26Sopenharmony_ci
1481b96c26Sopenharmony_ciimport("../../../dlp_permission_service.gni")
1581b96c26Sopenharmony_ci
1681b96c26Sopenharmony_cigroup("fuzztest") {
1781b96c26Sopenharmony_ci  testonly = true
1881b96c26Sopenharmony_ci  deps = []
1981b96c26Sopenharmony_ci
2081b96c26Sopenharmony_ci  deps += [
2181b96c26Sopenharmony_ci    "fuzzer/cancelretentionstate_fuzzer:CancelRetentionStateFuzzTest",
2281b96c26Sopenharmony_ci    "fuzzer/cleansandboxconfig_fuzzer:CleanSandboxConfigFuzzTest",
2381b96c26Sopenharmony_ci    "fuzzer/clearunreservedsandbox_fuzzer:ClearUnreservedSandboxFuzzTest",
2481b96c26Sopenharmony_ci    "fuzzer/dlpfile_fuzzer:DlpFileFuzzTest",
2581b96c26Sopenharmony_ci    "fuzzer/generatecert_fuzzer:GenerateCertFuzzTest",
2681b96c26Sopenharmony_ci    "fuzzer/getdlpfilevisitrecord_fuzzer:GetDlpFileVisitRecordFuzzTest",
2781b96c26Sopenharmony_ci    "fuzzer/getdlpgatheringpolicy_fuzzer:GetDlpGatheringPolicyFuzzTest",
2881b96c26Sopenharmony_ci    "fuzzer/getdlpsupportfiletype_fuzzer:GetDlpSupportFileTypeFuzzTest",
2981b96c26Sopenharmony_ci    "fuzzer/getmdmpolicy_fuzzer:GetMDMPolicyFuzzTest",
3081b96c26Sopenharmony_ci    "fuzzer/getretentionsandboxlist_fuzzer:GetRetentionSandboxListFuzzTest",
3181b96c26Sopenharmony_ci    "fuzzer/getsandboxconfig_fuzzer:GetSandboxConfigFuzzTest",
3281b96c26Sopenharmony_ci    "fuzzer/getsandboxexternalauthorization_fuzzer:GetSandboxExternalAuthorizationFuzzTest",
3381b96c26Sopenharmony_ci    "fuzzer/installdlpsandbox_fuzzer:InstallDlpSandboxFuzzTest",
3481b96c26Sopenharmony_ci    "fuzzer/isdlpfeatureprovided_fuzzer:IsDlpFeatureProvidedFuzzTest",
3581b96c26Sopenharmony_ci    "fuzzer/isindlpsandbox_fuzzer:IsInDlpSandboxFuzzTest",
3681b96c26Sopenharmony_ci    "fuzzer/parsecert_fuzzer:ParseCertFuzzTest",
3781b96c26Sopenharmony_ci    "fuzzer/parsedlpheader_fuzzer:ParseDlpHeaderFuzzTest",
3881b96c26Sopenharmony_ci    "fuzzer/querydlpfileaccess_fuzzer:QueryDlpFileAccessFuzzTest",
3981b96c26Sopenharmony_ci    "fuzzer/querydlpfilecopyablebytokenid_fuzzer:QueryDlpFileCopyableByTokenIdFuzzTest",
4081b96c26Sopenharmony_ci    "fuzzer/registerdlpsandboxchangecallback_fuzzer:RegisterDlpSandboxChangeCallbackFuzzTest",
4181b96c26Sopenharmony_ci    "fuzzer/registeropendlpfilecallback_fuzzer:RegisterOpenDlpFileCallbackFuzzTest",
4281b96c26Sopenharmony_ci    "fuzzer/removemdmpolicy_fuzzer:RemoveMDMPolicyFuzzTest",
4381b96c26Sopenharmony_ci    "fuzzer/setmdmpolicy_fuzzer:SetMDMPolicyFuzzTest",
4481b96c26Sopenharmony_ci    "fuzzer/setreadflag_fuzzer:SetReadFlagFuzzTest",
4581b96c26Sopenharmony_ci    "fuzzer/setretentionstate_fuzzer:SetRetentionStateFuzzTest",
4681b96c26Sopenharmony_ci    "fuzzer/setsandboxconfig_fuzzer:SetSandboxConfigFuzzTest",
4781b96c26Sopenharmony_ci    "fuzzer/uninstalldlpsandbox_fuzzer:UninstallDlpSandboxFuzzTest",
4881b96c26Sopenharmony_ci    "fuzzer/unregisterdlpsandboxchangecallback_fuzzer:UnRegisterDlpSandboxChangeCallbackFuzzTest",
4981b96c26Sopenharmony_ci    "fuzzer/unregisteropendlpfilecallback_fuzzer:UnRegisterOpenDlpFileCallbackFuzzTest",
5081b96c26Sopenharmony_ci    "stub_fuzzer/cancelretentionstatestub_fuzzer:CancelRetentionStateStubFuzzTest",
5181b96c26Sopenharmony_ci    "stub_fuzzer/cleansandboxconfigstub_fuzzer:CleanSandboxConfigStubFuzzTest",
5281b96c26Sopenharmony_ci    "stub_fuzzer/clearunreservedsandboxstub_fuzzer:ClearUnreservedSandboxStubFuzzTest",
5381b96c26Sopenharmony_ci    "stub_fuzzer/generatecertstub_fuzzer:GenerateCertStubFuzzTest",
5481b96c26Sopenharmony_ci    "stub_fuzzer/getdlpfilevisitrecordstub_fuzzer:GetDlpFileVisitRecordStubFuzzTest",
5581b96c26Sopenharmony_ci    "stub_fuzzer/getdlpgatheringpolicystub_fuzzer:GetDlpGatheringPolicyStubFuzzTest",
5681b96c26Sopenharmony_ci    "stub_fuzzer/getdlpsupportfiletypestub_fuzzer:GetDlpSupportFileTypeStubFuzzTest",
5781b96c26Sopenharmony_ci    "stub_fuzzer/getmdmpolicystub_fuzzer:GetMDMPolicyStubFuzzTest",
5881b96c26Sopenharmony_ci    "stub_fuzzer/getretentionsandboxliststub_fuzzer:GetRetentionSandboxListStubFuzzTest",
5981b96c26Sopenharmony_ci    "stub_fuzzer/getsandboxconfigstub_fuzzer:GetSandboxConfigStubFuzzTest",
6081b96c26Sopenharmony_ci    "stub_fuzzer/getsandboxexternalauthorizationstub_fuzzer:GetSandboxExternalAuthorizationStubFuzzTest",
6181b96c26Sopenharmony_ci    "stub_fuzzer/installdlpsandboxstub_fuzzer:InstallDlpSandboxStubFuzzTest",
6281b96c26Sopenharmony_ci    "stub_fuzzer/isdlpfeatureprovidedstub_fuzzer:IsDlpFeatureProvidedStubFuzzTest",
6381b96c26Sopenharmony_ci    "stub_fuzzer/isindlpsandboxstub_fuzzer:IsInDlpSandboxStubFuzzTest",
6481b96c26Sopenharmony_ci    "stub_fuzzer/parsecertstub_fuzzer:ParseCertStubFuzzTest",
6581b96c26Sopenharmony_ci    "stub_fuzzer/querydlpfileaccessstub_fuzzer:QueryDlpFileAccessStubFuzzTest",
6681b96c26Sopenharmony_ci    "stub_fuzzer/querydlpfilecopyablebytokenidstub_fuzzer:QueryDlpFileCopyableByTokenIdStubFuzzTest",
6781b96c26Sopenharmony_ci    "stub_fuzzer/registerdlpsandboxchangecallbackstub_fuzzer:RegisterDlpSandboxChangeCallbackStubFuzzTest",
6881b96c26Sopenharmony_ci    "stub_fuzzer/registeropendlpfilecallbackstub_fuzzer:RegisterOpenDlpFileCallbackStubFuzzTest",
6981b96c26Sopenharmony_ci    "stub_fuzzer/removemdmpolicystub_fuzzer:RemoveMDMPolicyStubFuzzTest",
7081b96c26Sopenharmony_ci    "stub_fuzzer/setmdmpolicystub_fuzzer:SetMDMPolicyStubFuzzTest",
7181b96c26Sopenharmony_ci    "stub_fuzzer/setreadflagstub_fuzzer:SetReadFlagStubFuzzTest",
7281b96c26Sopenharmony_ci    "stub_fuzzer/setretentionstatestub_fuzzer:SetRetentionStateStubFuzzTest",
7381b96c26Sopenharmony_ci    "stub_fuzzer/setsandboxconfigstub_fuzzer:SetSandboxConfigStubFuzzTest",
7481b96c26Sopenharmony_ci    "stub_fuzzer/uninstalldlpsandboxstub_fuzzer:UninstallDlpSandboxStubFuzzTest",
7581b96c26Sopenharmony_ci    "stub_fuzzer/unregisterdlpsandboxchangecallbackstub_fuzzer:UnRegisterDlpSandboxChangeCallbackStubFuzzTest",
7681b96c26Sopenharmony_ci    "stub_fuzzer/unregisteropendlpfilecallbackstub_fuzzer:UnRegisterOpenDlpFileCallbackStubFuzzTest",
7781b96c26Sopenharmony_ci  ]
7881b96c26Sopenharmony_ci}
7981b96c26Sopenharmony_ci
8081b96c26Sopenharmony_ciconfig("napi_fuzz_config") {
8181b96c26Sopenharmony_ci  include_dirs = [
8281b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/sa_common",
8381b96c26Sopenharmony_ci    "${dlp_root_dir}/interfaces/inner_api/dlp_permission/include",
8481b96c26Sopenharmony_ci    "${dlp_root_dir}/test/fuzztest/dlp_permission/fuzzer",
8581b96c26Sopenharmony_ci  ]
8681b96c26Sopenharmony_ci  cflags = [
8781b96c26Sopenharmony_ci    "-g",
8881b96c26Sopenharmony_ci    "-O0",
8981b96c26Sopenharmony_ci    "-Wno-unused-variable",
9081b96c26Sopenharmony_ci    "-fno-omit-frame-pointer",
9181b96c26Sopenharmony_ci  ]
9281b96c26Sopenharmony_ci  configs = [ "${dlp_root_dir}/config:coverage_flags" ]
9381b96c26Sopenharmony_ci  cflags_cc = [ "-DHILOG_ENABLE" ]
9481b96c26Sopenharmony_ci}
9581b96c26Sopenharmony_ci
9681b96c26Sopenharmony_ciconfig("stub_fuzz_config") {
9781b96c26Sopenharmony_ci  include_dirs = []
9881b96c26Sopenharmony_ci  configs = [ ":napi_fuzz_config" ]
9981b96c26Sopenharmony_ci  include_dirs += [
10081b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/common/include",
10181b96c26Sopenharmony_ci    "${dlp_root_dir}/frameworks/dlp_permission/include",
10281b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/adapt",
10381b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/callback/dlp_sandbox_change_callback/",
10481b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/callback/open_dlp_file_callback/",
10581b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/mock",
10681b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/sa_main",
10781b96c26Sopenharmony_ci    "${dlp_root_dir}/services/dlp_permission/sa/storage/include",
10881b96c26Sopenharmony_ci  ]
10981b96c26Sopenharmony_ci}
11081b96c26Sopenharmony_ci
11181b96c26Sopenharmony_ciconfig("stub_fuzz_need_skip_timer_config") {
11281b96c26Sopenharmony_ci  cflags_cc = []
11381b96c26Sopenharmony_ci  configs = [ ":stub_fuzz_config" ]
11481b96c26Sopenharmony_ci  cflags_cc += [ "-DDLP_FUZZ_TEST" ]
11581b96c26Sopenharmony_ci}
116