# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. module_output_path = "startup/fuzztest" #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/ohos.gni") import("//build/test.gni") ohos_static_library("libfuzz_utils") { sources = [ "utils/fuzz_utils.cpp" ] include_dirs = [ "//base/startup/init_lite/test/fuzztest/utils/include" ] deps = [] part_name = "init" } ##############################fuzztest########################################## ohos_fuzztest("test_startup_DoRebootFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//base/startup/init_lite/services/log:init_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_DoReboot_fuzzer/test_startup_DoReboot_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_GetControlFileFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//base/startup/init_lite/services/log:init_log", "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/bounds_checking_function:libsec_static", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_GetControlFile_fuzzer/test_startup_GetControlFile_fuzzer.cpp", ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_GetControlSocketFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//base/startup/init_lite/services/log:init_log", "//third_party/bounds_checking_function:libsec_static", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_GetControlSocket_fuzzer/test_startup_GetControlSocket_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_MountAllFstabFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//base/startup/init_lite/services/log:init_log", "//base/startup/init_lite/services/utils:libinit_utils", "//base/startup/init_lite/test/fuzztest:libfuzz_utils", "//third_party/bounds_checking_function:libsec_static", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_MountAllFstab_fuzzer/test_startup_MountAllFstab_fuzzer.cpp", ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_ReadFileInDirFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/init/include", "//base/startup/init_lite/services/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:init_log", "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/bounds_checking_function:libsec_static", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_ReadFileInDir_fuzzer/test_startup_ReadFileInDir_fuzzer.cpp", ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_ServiceControlStartFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//base/startup/init_lite/services/param:param_client", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_ServiceControlStart_fuzzer/test_startup_ServiceControlStart_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_ServiceControlStopFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//base/startup/init_lite/services/param:param_client", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_ServiceControlStop_fuzzer/test_startup_ServiceControlStop_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemDumpParametersFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//base/startup/init_lite/test/fuzztest:libfuzz_utils", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemDumpParameters_fuzzer/test_startup_SystemDumpParameters_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemFindParameterFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemFindParameter_fuzzer/test_startup_SystemFindParameter_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemGetParameterFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemGetParameter_fuzzer/test_startup_SystemGetParameter_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemGetParameterCommitIdFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemGetParameterCommitId_fuzzer/test_startup_SystemGetParameterCommitId_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemGetParameterNameFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemGetParameterName_fuzzer/test_startup_SystemGetParameterName_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemGetParameterValueFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemGetParameterValue_fuzzer/test_startup_SystemGetParameterValue_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemSetParameterFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemSetParameter_fuzzer/test_startup_SystemSetParameter_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemTraversalParameterFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/services/init/include", "//base/startup/init_lite/test/fuzztest/utils/include", "//third_party/bounds_checking_function/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//base/startup/init_lite/test/fuzztest:libfuzz_utils", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemTraversalParameter_fuzzer/test_startup_SystemTraversalParameter_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemWaitParameterFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//third_party/bounds_checking_function:libsec_static", ] external_deps = [ "hiviewdfx_hilog_native:libhilog" ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemWaitParameter_fuzzer/test_startup_SystemWaitParameter_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_SystemWatchParameterFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/services/include/param", "//base/startup/init_lite/services/init/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/services/log:agent_log", "//base/startup/init_lite/services/param:param_client", "//base/startup/init_lite/services/param/watcher:param_watcheragent", "//third_party/bounds_checking_function:libsec_static", "//utils/native/base:utils", ] external_deps = [ "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr_standard:samgr_proxy", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_SystemWatchParameter_fuzzer/test_startup_SystemWatchParameter_fuzzer.cpp" ] defines = [ "STARTUP_INIT_TEST" ] } ohos_fuzztest("test_startup_UmountAllFstabFuzzTest") { module_out_path = module_output_path include_dirs = [ "//base/startup/init_lite/interfaces/innerkits/include", "//base/startup/init_lite/test/fuzztest/utils/include", ] deps = [ "//base/startup/init_lite/interfaces/innerkits:libfsmanager_static", "//base/startup/init_lite/services/log:init_log", "//base/startup/init_lite/services/utils:libinit_utils", "//base/startup/init_lite/test/fuzztest:libfuzz_utils", "//third_party/bounds_checking_function:libsec_static", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "test_startup_UmountAllFstab_fuzzer/test_startup_UmountAllFstab_fuzzer.cpp", ] defines = [ "STARTUP_INIT_TEST" ] } ############################################################################### group("fuzztest") { testonly = true deps = [] deps += [ # deps file ":test_startup_DoRebootFuzzTest", ":test_startup_GetControlFileFuzzTest", ":test_startup_GetControlSocketFuzzTest", ":test_startup_MountAllFstabFuzzTest", ":test_startup_ReadFileInDirFuzzTest", ":test_startup_ServiceControlStartFuzzTest", ":test_startup_ServiceControlStopFuzzTest", ":test_startup_SystemDumpParametersFuzzTest", ":test_startup_SystemFindParameterFuzzTest", ":test_startup_SystemGetParameterCommitIdFuzzTest", ":test_startup_SystemGetParameterFuzzTest", ":test_startup_SystemGetParameterNameFuzzTest", ":test_startup_SystemGetParameterValueFuzzTest", ":test_startup_SystemSetParameterFuzzTest", ":test_startup_SystemTraversalParameterFuzzTest", ":test_startup_SystemWaitParameterFuzzTest", ":test_startup_SystemWatchParameterFuzzTest", ":test_startup_UmountAllFstabFuzzTest", ] } ###############################################################################