From 9b9cc7e27c89f0b0e46195887ce869111f64af5c Mon Sep 17 00:00:00 2001 From: w00661648 Date: Sat, 19 Aug 2023 11:25:11 +0800 Subject: [PATCH] add patch json Signed-off-by: w00661648 --- bundle.json | 2 +- interfaces/innerkits/BUILD.gn | 2 +- interfaces/kits/js/napi/BUILD.gn | 2 +- patches/patches.json | 7 ++ services/BUILD.gn | 2 +- .../src/ecological_rule_engine_cache.cpp | 5 +- .../src/ecological_rule_calculator_impl.cpp | 1 - test/fuzztest/BUILD.gn | 0 .../BUILD.gn | 89 +++++++++++++++++++ .../EcologicalRileMgrServiceStubFuzzer.cpp | 1 + .../EcologicalRileMgrServiceStubFuzzer.h | 0 .../corpus/init | 0 .../project.xml | 25 ++++++ test/unittest/BUILD.gn | 2 +- utils/BUILD.gn | 2 +- 15 files changed, 129 insertions(+), 11 deletions(-) create mode 100644 patches/patches.json create mode 100644 test/fuzztest/BUILD.gn create mode 100644 test/fuzztest/ecologicalrulemgrservicestub_fuzzer/BUILD.gn create mode 100644 test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.cpp create mode 100644 test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.h create mode 100644 test/fuzztest/ecologicalrulemgrservicestub_fuzzer/corpus/init create mode 100644 test/fuzztest/ecologicalrulemgrservicestub_fuzzer/project.xml diff --git a/bundle.json b/bundle.json index cb54e09..5e3674f 100644 --- a/bundle.json +++ b/bundle.json @@ -33,7 +33,7 @@ "common_event_service", "distributeddatamgr", "eventhandler", - "hiviewdfx_hilog_native", + "hilog", "ipc", "napi", "permission_standard", diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index a51b0c9..ccfd067 100644 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -45,7 +45,7 @@ ohos_shared_library("erms_client") { "common_event_service:cesfwk_innerkits", "c_utils:utils", "eventhandler:libeventhandler", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/interfaces/kits/js/napi/BUILD.gn b/interfaces/kits/js/napi/BUILD.gn index 5f62c9c..4e487f3 100644 --- a/interfaces/kits/js/napi/BUILD.gn +++ b/interfaces/kits/js/napi/BUILD.gn @@ -49,7 +49,7 @@ ohos_shared_library("ecologicalrulemgrservice") { "ability_runtime:wantagent_innerkits", "ability_runtime:abilitykit_native", "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", "napi:ace_napi" ] diff --git a/patches/patches.json b/patches/patches.json new file mode 100644 index 0000000..12d3073 --- /dev/null +++ b/patches/patches.json @@ -0,0 +1,7 @@ +{ + "patches": [{ + "project": "productdefine_common", + "path": "productdefine/common", + "pr_url": "https://gitee.com/openharmony/productdefine_common/pulls/692" + }] +} \ No newline at end of file diff --git a/services/BUILD.gn b/services/BUILD.gn index c8c61d8..9a86544 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -75,7 +75,7 @@ ohos_shared_library("ecologicalrulemgr_service") { "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/services/enginecache/src/ecological_rule_engine_cache.cpp b/services/enginecache/src/ecological_rule_engine_cache.cpp index 4c4deab..fc70cdb 100644 --- a/services/enginecache/src/ecological_rule_engine_cache.cpp +++ b/services/enginecache/src/ecological_rule_engine_cache.cpp @@ -120,8 +120,7 @@ int32_t EcologicalRuleEngineCache::GetMapItem(nlohmann::json *&inputJson, const int32_t EcologicalRuleEngineCache::RefreshAppEnhanceData(const int32_t operType, const std::string &appData) { - LOG_INFO("refresh enhance success, operType = %{public}d, appData.length = %{public}lu", operType, - appData.length()); + LOG_INFO("refresh enhance success, operType = %{public}d", operType); return 0; } @@ -387,8 +386,6 @@ void EcologicalRuleEngineCache::ClearSceneCodeCache() std::list &sceneCodeList = iter->second; for (auto iterList = sceneCodeList.begin(); iterList != sceneCodeList.end();) { if (iterList->timestamp + EngineCacheConstants::TIMER_INTERVAL_60MIN_MS < curTime) { - LOG_DEBUG("erase scene_code,bundle:%{public}s,sceneCode:%{public}s,timestamp:%{public}lu", - iter->first.c_str(), iterList->sceneCode.c_str(), iterList->timestamp); sceneCodeList.erase(iterList++); } else { iterList++; diff --git a/services/ruleengine/src/ecological_rule_calculator_impl.cpp b/services/ruleengine/src/ecological_rule_calculator_impl.cpp index c0285d4..5ac8b16 100644 --- a/services/ruleengine/src/ecological_rule_calculator_impl.cpp +++ b/services/ruleengine/src/ecological_rule_calculator_impl.cpp @@ -470,7 +470,6 @@ int32_t EcologicalRuleCalculatorImpl::ConstructRuleStrategyObjects() } catch (...) { LOG_ERROR("fail: catch exception."); } - LOG_INFO("finish! ruleStrategyObjects size is %{public}lu", ruleStrategyObjects.size()); ReleaseRuleStrategyObjectLock(); return SUCCESS_RULE; } diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn new file mode 100644 index 0000000..e69de29 diff --git a/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/BUILD.gn b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/BUILD.gn new file mode 100644 index 0000000..c125485 --- /dev/null +++ b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/BUILD.gn @@ -0,0 +1,89 @@ +# 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/test.gni") +import("//foundation/bundlemanager/ecological_rule_mgr/ecologicalrulemgrservice.gni") + +module_output_path = "ecological_rule_mgr/stubFuzzTest" + +##############################fuzztest########################################## +ohos_fuzztest("EcologicalRuleMgrServiceStubFuzzTest") { # 定义测试套名称ShareManagerSrvStubFuzzTest + module_out_path = "HuaweiShare/iShare" + fuzz_config_file = "${share_root_path}/test/fuzztest/ecologicalrulemgrservicestub_fuzzer" # Fuzz组套路径 + + include_dirs = [ + "../../services/manager/include", + "../../services/ruleengine/include", + "../../services/enginecache/include", + "include", + "${innerkits_path}/include", + "//utils/system/safwk/native/include", + "//base/hiviewdfx/hilog/interfaces/native/innerkits/include", + "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_core/include", + "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy/include", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", + ] + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + + sources = [ + "EcologicalRileMgrServiceStubFuzzer.cpp", # Fuzz用例文件 + ] + + deps = [ + "ability_base:want", + "ability_base:zuri", + "ability_runtime:abilitykit_native", + "ability_runtime:runtime", + "ability_runtime:wantagent_innerkits", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "common_event_service:cesfwk_innerkits", + "common_event_service:cesfwk_innerkits", + "c_utils:utils", + "hilog:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", + "access_token:libaccesstoken_sdk", + "access_token:libtokenid_sdk", + "access_token:libnativetoken", + "access_token:libtoken_setproc", + ] + + external_deps = [ + "c_utils:utils", + "device_manager:devicemanagersdk", + "graphic_2d:surface", + "hilog:libhilog", + "input:libmmi-client", + "ipc:ipc_core", + "safwk:system_ability_fwk", + ] +} +############################################################################### +group("fuzztest") { # [Group]引用Fuzz测试套 + testonly = true + deps = [] + deps += [ + ":EcologicalRuleMgrServiceStubFuzzTest", + ] +} +############################################################################### \ No newline at end of file diff --git a/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.cpp b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.cpp new file mode 100644 index 0000000..6b7212c --- /dev/null +++ b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.cpp @@ -0,0 +1 @@ +FUZZ \ No newline at end of file diff --git a/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.h b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/EcologicalRileMgrServiceStubFuzzer.h new file mode 100644 index 0000000..e69de29 diff --git a/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/corpus/init b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/corpus/init new file mode 100644 index 0000000..e69de29 diff --git a/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/project.xml b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/project.xml new file mode 100644 index 0000000..3fdba3e --- /dev/null +++ b/test/fuzztest/ecologicalrulemgrservicestub_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + \ No newline at end of file diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 6fb7ece..6415790 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -57,7 +57,7 @@ ohos_unittest("EcologicalRuleMgrServiceClientTest") { "common_event_service:cesfwk_innerkits", "common_event_service:cesfwk_innerkits", "c_utils:utils", - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 8bb40b9..d642e38 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -29,7 +29,7 @@ ohos_source_set("ecologicalrulemgrservice_utils") { ] external_deps = [ - "hiviewdfx_hilog_native:libhilog", + "hilog:libhilog", ] part_name = "ecological_rule_mgr"