# Copyright (c) 2023 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. #####################hydra-fuzz################### import("//build/config/features.gni") import("//build/ohos.gni") import("//build/test.gni") import("../../../time.gni") ##############################fuzztest########################################## timeboundarycode_test = { targetName = "TimeBoundaryCodeFuzzTest" configFuzzer = "timeboundarycode_fuzzer" source = "timeboundarycode_fuzzer/timeboundarycode_fuzzer.cpp" } timecreatetimer_test = { targetName = "TimeCreateTimerFuzzTest" configFuzzer = "timecreatetimer_fuzzer" source = "timecreatetimer_fuzzer/timecreatetimer_fuzzer.cpp" } timedestroytimer_test = { targetName = "TimeDestroyTimerFuzzTest" configFuzzer = "timedestroytimer_fuzzer" source = "timedestroytimer_fuzzer/timedestroytimer_fuzzer.cpp" } timegetthreadtimemilli_test = { targetName = "TimeGetThreadTimeMilliFuzzTest" configFuzzer = "timegetthreadtimemilli_fuzzer" source = "timegetthreadtimemilli_fuzzer/timegetthreadtimemilli_fuzzer.cpp" } timegetthreadtimenano_test = { targetName = "TimeGetThreadTimeNanoFuzzTest" configFuzzer = "timegetthreadtimenano_fuzzer" source = "timegetthreadtimenano_fuzzer/timegetthreadtimenano_fuzzer.cpp" } timegettimezone_test = { targetName = "TimeGetTimeZoneFuzzTest" configFuzzer = "timegettimezone_fuzzer" source = "timegettimezone_fuzzer/timegettimezone_fuzzer.cpp" } timereceivedmessage_test = { targetName = "TimeReceivedMessageFuzzTest" configFuzzer = "timereceivedmessage_fuzzer" source = "timereceivedmessage_fuzzer/timereceivedmessage_fuzzer.cpp" } timeservicesettimezone_test = { targetName = "TimeServiceSetTimeZoneFuzzTest" configFuzzer = "timeservicesettimezone_fuzzer" source = "timeservicesettimezone_fuzzer/timeservicesettimezone_fuzzer.cpp" } timestarttimer_test = { targetName = "TimeStartTimerFuzzTest" configFuzzer = "timestarttimer_fuzzer" source = "timestarttimer_fuzzer/timestarttimer_fuzzer.cpp" } timestoptimer_test = { targetName = "TimeStopTimerFuzzTest" configFuzzer = "timestoptimer_fuzzer" source = "timestoptimer_fuzzer/timestoptimer_fuzzer.cpp" } timerproxy_test = { targetName = "TimerProxyFuzzTest" configFuzzer = "timerproxy_fuzzer" source = "timerproxy_fuzzer/timerproxy_fuzzer.cpp" } timesntp_test = { targetName = "TimeSntpFuzzTest" configFuzzer = "timesntp_fuzzer" source = "timesntp_fuzzer/timesntp_fuzzer.cpp" } time_fuzztests = [ timeboundarycode_test, timecreatetimer_test, timedestroytimer_test, timegetthreadtimemilli_test, timegetthreadtimenano_test, timegettimezone_test, timereceivedmessage_test, timeservicesettimezone_test, timestarttimer_test, timestoptimer_test, timerproxy_test, timesntp_test, ] foreach(item, time_fuzztests) { ohos_fuzztest(item.targetName) { module_out_path = "time_service/time" fuzz_config_file = "${time_root_path}/test/fuzztest/timeservice_fuzzer/${item.configFuzzer}" include_dirs = [ "${time_service_path}", "${time_service_path}/dfx/include", "${time_service_path}/time/include", "${time_utils_path}/native/include", "${time_service_path}/ipc/stub", "${time_service_path}/ipc/base", "${api_path}/include", "${time_service_path}/timer/include", "${time_root_path}/test/fuzztest/timeservice_fuzzer/common", ] cflags = [ "-g", "-O0", "-Wno-unused-variable", "-fno-omit-frame-pointer", ] sources = [ "common/time_service_fuzz_utils.cpp", item.source, ] deps = [ "${time_service_path}:time_system_ability_static" ] external_deps = [ "ability_base:want", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", "access_token:libnativetoken", "access_token:libtoken_setproc", "bundle_framework:appexecfwk_core", "c_utils:utils", "common_event_service:cesfwk_innerkits", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_single", "power_manager:powermgr_client", "relational_store:native_dataability", "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] } } ############################################################################### group("fuzztest") { testonly = true deps = [] deps += [ # deps file ":TimeBoundaryCodeFuzzTest", ":TimeCreateTimerFuzzTest", ":TimeDestroyTimerFuzzTest", ":TimeGetThreadTimeMilliFuzzTest", ":TimeGetThreadTimeNanoFuzzTest", ":TimeGetTimeZoneFuzzTest", ":TimeReceivedMessageFuzzTest", ":TimeServiceSetTimeZoneFuzzTest", ":TimeSntpFuzzTest", ":TimeStartTimerFuzzTest", ":TimeStopTimerFuzzTest", ":TimerProxyFuzzTest", ] } ###############################################################################