diff --git a/kernel.mk b/kernel.mk index 5de5dc9..31ffd7f 100644 --- a/kernel.mk +++ b/kernel.mk @@ -63,7 +63,7 @@ endif ifneq ($(findstring $(BUILD_TYPE), small standard),) DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch -PRODUCT_PATCH_FILE := $(OHOS_BUILD_HOME)/vendor/hisilicon/watchos/patchs/$(DEVICE_NAME).patch +PRODUCT_PATCH_FILE := $(OHOS_BUILD_HOME)/vendor/hisilicon/watchos/patches/$(DEVICE_NAME).patch SMALL_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME)_$(BUILD_TYPE).patch KERNEL_IMAGE_FILE := $(KERNEL_SRC_TMP_PATH)/arch/$(KERNEL_ARCH)/boot/$(KERNEL_IMAGE) DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig diff --git a/test/fuzztest/BUILD.gn b/test/fuzztest/BUILD.gn index 267f1ed..f3942ad 100644 --- a/test/fuzztest/BUILD.gn +++ b/test/fuzztest/BUILD.gn @@ -18,6 +18,7 @@ group("fuzztest") { deps += [ "accesstokenid:fuzztest", "hc_node:fuzztest", + "memory:fuzztest", "sched:fuzztest", ] } diff --git a/test/fuzztest/accesstokenid/accessftokenidgrptest_fuzzer/accessftokenidgrptest_fuzzer.cpp b/test/fuzztest/accesstokenid/accessftokenidgrptest_fuzzer/accessftokenidgrptest_fuzzer.cpp index c535b27..aa78808 100644 --- a/test/fuzztest/accesstokenid/accessftokenidgrptest_fuzzer/accessftokenidgrptest_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/accessftokenidgrptest_fuzzer/accessftokenidgrptest_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accessftokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/accessftokenidgrptestother_fuzzer/accessftokenidgrptestother_fuzzer.cpp b/test/fuzztest/accesstokenid/accessftokenidgrptestother_fuzzer/accessftokenidgrptestother_fuzzer.cpp index 399d77f..5f5c841 100644 --- a/test/fuzztest/accesstokenid/accessftokenidgrptestother_fuzzer/accessftokenidgrptestother_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/accessftokenidgrptestother_fuzzer/accessftokenidgrptestother_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accessftokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/accessftokenidthreadtest_fuzzer/accessftokenidthreadtest_fuzzer.cpp b/test/fuzztest/accesstokenid/accessftokenidthreadtest_fuzzer/accessftokenidthreadtest_fuzzer.cpp index 4212980..9e8fbd6 100644 --- a/test/fuzztest/accesstokenid/accessftokenidthreadtest_fuzzer/accessftokenidthreadtest_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/accessftokenidthreadtest_fuzzer/accessftokenidthreadtest_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accessftokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/accesstokenidgrptest_fuzzer/accesstokenidgrptest_fuzzer.cpp b/test/fuzztest/accesstokenid/accesstokenidgrptest_fuzzer/accesstokenidgrptest_fuzzer.cpp index af5b636..872a7bd 100644 --- a/test/fuzztest/accesstokenid/accesstokenidgrptest_fuzzer/accesstokenidgrptest_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/accesstokenidgrptest_fuzzer/accesstokenidgrptest_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/accesstokenidgrptestother_fuzzer/accesstokenidgrptestother_fuzzer.cpp b/test/fuzztest/accesstokenid/accesstokenidgrptestother_fuzzer/accesstokenidgrptestother_fuzzer.cpp index a4e57da..d0437f9 100644 --- a/test/fuzztest/accesstokenid/accesstokenidgrptestother_fuzzer/accesstokenidgrptestother_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/accesstokenidgrptestother_fuzzer/accesstokenidgrptestother_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/accesstokenidthreadtest_fuzzer/accesstokenidthreadtest_fuzzer.cpp b/test/fuzztest/accesstokenid/accesstokenidthreadtest_fuzzer/accesstokenidthreadtest_fuzzer.cpp index 5215747..0aadbf7 100644 --- a/test/fuzztest/accesstokenid/accesstokenidthreadtest_fuzzer/accesstokenidthreadtest_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/accesstokenidthreadtest_fuzzer/accesstokenidthreadtest_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/getftokenidcmdcorrect_fuzzer/getftokenidcmdcorrect_fuzzer.cpp b/test/fuzztest/accesstokenid/getftokenidcmdcorrect_fuzzer/getftokenidcmdcorrect_fuzzer.cpp index 1173bb9..0425ea0 100644 --- a/test/fuzztest/accesstokenid/getftokenidcmdcorrect_fuzzer/getftokenidcmdcorrect_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/getftokenidcmdcorrect_fuzzer/getftokenidcmdcorrect_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accessftokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/getftokenidnullptr_fuzzer/getftokenidnullptr_fuzzer.cpp b/test/fuzztest/accesstokenid/getftokenidnullptr_fuzzer/getftokenidnullptr_fuzzer.cpp index c098598..8dbfbf3 100644 --- a/test/fuzztest/accesstokenid/getftokenidnullptr_fuzzer/getftokenidnullptr_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/getftokenidnullptr_fuzzer/getftokenidnullptr_fuzzer.cpp @@ -16,6 +16,9 @@ */ #include +#include +#include +#include "__config" #include "accessftokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp b/test/fuzztest/accesstokenid/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp index 40762c2..4f2e592 100644 --- a/test/fuzztest/accesstokenid/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/gettokenidcmdcorrect_fuzzer/gettokenidcmdcorrect_fuzzer.cpp @@ -16,6 +16,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp b/test/fuzztest/accesstokenid/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp index 46d305e..e594226 100644 --- a/test/fuzztest/accesstokenid/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/gettokenidcmderror_fuzzer/gettokenidcmderror_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #define CMDERROR #include "accesstokenidcommon.h" diff --git a/test/fuzztest/accesstokenid/gettokenidnullptr_fuzzer/gettokenidnullptr_fuzzer.cpp b/test/fuzztest/accesstokenid/gettokenidnullptr_fuzzer/gettokenidnullptr_fuzzer.cpp index 5be434e..a6a862f 100644 --- a/test/fuzztest/accesstokenid/gettokenidnullptr_fuzzer/gettokenidnullptr_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/gettokenidnullptr_fuzzer/gettokenidnullptr_fuzzer.cpp @@ -16,6 +16,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/include/accessftokenidcommon.h b/test/fuzztest/accesstokenid/include/accessftokenidcommon.h index e0c3903..fe074a4 100644 --- a/test/fuzztest/accesstokenid/include/accessftokenidcommon.h +++ b/test/fuzztest/accesstokenid/include/accessftokenidcommon.h @@ -15,6 +15,7 @@ #ifndef ACCESSFTOKENIDCOMMON_H #define ACCESSFTOKENIDCOMMON_H +#include #define FUZZ_PROJECT_NAME "accessftokenidcommon" diff --git a/test/fuzztest/accesstokenid/include/accesstokenidcommon.h b/test/fuzztest/accesstokenid/include/accesstokenidcommon.h index febe475..7b1cd98 100644 --- a/test/fuzztest/accesstokenid/include/accesstokenidcommon.h +++ b/test/fuzztest/accesstokenid/include/accesstokenidcommon.h @@ -15,6 +15,7 @@ #ifndef ACCESSTOKENIDCOMMON_H #define ACCESSTOKENIDCOMMON_H +#include #define FUZZ_PROJECT_NAME "accesstokenidcommon" diff --git a/test/fuzztest/accesstokenid/setftokenidcmdcorrect_fuzzer/setftokenidcmdcorrect_fuzzer.cpp b/test/fuzztest/accesstokenid/setftokenidcmdcorrect_fuzzer/setftokenidcmdcorrect_fuzzer.cpp index 000316c..595cabd 100644 --- a/test/fuzztest/accesstokenid/setftokenidcmdcorrect_fuzzer/setftokenidcmdcorrect_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/setftokenidcmdcorrect_fuzzer/setftokenidcmdcorrect_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #include "accessftokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/setftokenidcmderror_fuzzer/setftokenidcmderror_fuzzer.cpp b/test/fuzztest/accesstokenid/setftokenidcmderror_fuzzer/setftokenidcmderror_fuzzer.cpp index 9a2f085..d3b9184 100644 --- a/test/fuzztest/accesstokenid/setftokenidcmderror_fuzzer/setftokenidcmderror_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/setftokenidcmderror_fuzzer/setftokenidcmderror_fuzzer.cpp @@ -14,6 +14,9 @@ */ #include +#include +#include +#include "__config" #define CMDERROR #include "accessftokenidcommon.h" diff --git a/test/fuzztest/accesstokenid/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp b/test/fuzztest/accesstokenid/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp index 7183f67..0bd4263 100644 --- a/test/fuzztest/accesstokenid/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/settokenidcmdcorrect_fuzzer/settokenidcmdcorrect_fuzzer.cpp @@ -16,6 +16,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/settokenidnullptr_fuzzer/settokenidnullptr_fuzzer.cpp b/test/fuzztest/accesstokenid/settokenidnullptr_fuzzer/settokenidnullptr_fuzzer.cpp index 715454c..b8fa5ea 100644 --- a/test/fuzztest/accesstokenid/settokenidnullptr_fuzzer/settokenidnullptr_fuzzer.cpp +++ b/test/fuzztest/accesstokenid/settokenidnullptr_fuzzer/settokenidnullptr_fuzzer.cpp @@ -16,6 +16,9 @@ */ #include +#include +#include +#include "__config" #include "accesstokenidcommon.h" using namespace std; diff --git a/test/fuzztest/accesstokenid/src/accessftokenidcommon.cpp b/test/fuzztest/accesstokenid/src/accessftokenidcommon.cpp index 6fa504f..7f6b538 100644 --- a/test/fuzztest/accesstokenid/src/accessftokenidcommon.cpp +++ b/test/fuzztest/accesstokenid/src/accessftokenidcommon.cpp @@ -13,16 +13,13 @@ * limitations under the License. */ -#include -#include -#include -#include -#include -#include #include #include -#include -#include +#include +#include +#include +#include +#include #include "accessftokenidcommon.h" namespace OHOS { diff --git a/test/fuzztest/accesstokenid/src/accesstokenidcommon.cpp b/test/fuzztest/accesstokenid/src/accesstokenidcommon.cpp index 1be96bd..69d3471 100644 --- a/test/fuzztest/accesstokenid/src/accesstokenidcommon.cpp +++ b/test/fuzztest/accesstokenid/src/accesstokenidcommon.cpp @@ -13,16 +13,13 @@ * limitations under the License. */ -#include -#include -#include -#include -#include -#include #include #include -#include -#include +#include +#include +#include +#include +#include #include "accesstokenidcommon.h" namespace OHOS { diff --git a/test/fuzztest/hc_node/hcenable_fuzzer/hcenable_fuzzer.cpp b/test/fuzztest/hc_node/hcenable_fuzzer/hcenable_fuzzer.cpp index 7c7c9f0..93eac67 100644 --- a/test/fuzztest/hc_node/hcenable_fuzzer/hcenable_fuzzer.cpp +++ b/test/fuzztest/hc_node/hcenable_fuzzer/hcenable_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_ENABLE = "/sys/fs/f2fs/loop1/hc_enable"; diff --git a/test/fuzztest/hc_node/hchotdatalowerlimit_fuzzer/hchotdatalowerlimit_fuzzer.cpp b/test/fuzztest/hc_node/hchotdatalowerlimit_fuzzer/hchotdatalowerlimit_fuzzer.cpp index 8a1af0c..5918d1e 100644 --- a/test/fuzztest/hc_node/hchotdatalowerlimit_fuzzer/hchotdatalowerlimit_fuzzer.cpp +++ b/test/fuzztest/hc_node/hchotdatalowerlimit_fuzzer/hchotdatalowerlimit_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_HOT_DATA_LOWER_LIMIT = "/sys/fs/f2fs/loop1/hc_hot_data_lower_limit"; diff --git a/test/fuzztest/hc_node/hchotdatawaterline_fuzzer/hchotdatawaterline_fuzzer.cpp b/test/fuzztest/hc_node/hchotdatawaterline_fuzzer/hchotdatawaterline_fuzzer.cpp index 189b67b..e037e72 100644 --- a/test/fuzztest/hc_node/hchotdatawaterline_fuzzer/hchotdatawaterline_fuzzer.cpp +++ b/test/fuzztest/hc_node/hchotdatawaterline_fuzzer/hchotdatawaterline_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_HOT_DATA_WATERLINE = "/sys/fs/f2fs/loop1/hc_hot_data_waterline"; diff --git a/test/fuzztest/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp b/test/fuzztest/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp index 5799c61..8f5b0bf 100644 --- a/test/fuzztest/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp +++ b/test/fuzztest/hc_node/hchotnodelowerlimit_fuzzer/hchotnodelowerlimit_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_HOT_NODE_LOWER_LIMIT = "/sys/fs/f2fs/loop1/hc_hot_node_lower_limit"; diff --git a/test/fuzztest/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp b/test/fuzztest/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp index 2ef9b15..2910e8b 100644 --- a/test/fuzztest/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp +++ b/test/fuzztest/hc_node/hchotnodewaterline_fuzzer/hchotnodewaterline_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_HOT_NODE_WATERLINE = "/sys/fs/f2fs/loop1/hc_hot_node_waterline"; diff --git a/test/fuzztest/hc_node/hcwarmdatalowerlimit_fuzzer/hcwarmdatalowerlimit_fuzzer.cpp b/test/fuzztest/hc_node/hcwarmdatalowerlimit_fuzzer/hcwarmdatalowerlimit_fuzzer.cpp index 9691fba..849fefa 100644 --- a/test/fuzztest/hc_node/hcwarmdatalowerlimit_fuzzer/hcwarmdatalowerlimit_fuzzer.cpp +++ b/test/fuzztest/hc_node/hcwarmdatalowerlimit_fuzzer/hcwarmdatalowerlimit_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_WARM_DATA_LOWER_LIMIT = "/sys/fs/f2fs/loop1/hc_warm_data_lower_limit"; diff --git a/test/fuzztest/hc_node/hcwarmdatawaterline_fuzzer/hcwarmdatawaterline_fuzzer.cpp b/test/fuzztest/hc_node/hcwarmdatawaterline_fuzzer/hcwarmdatawaterline_fuzzer.cpp index 040152f..02eedd3 100644 --- a/test/fuzztest/hc_node/hcwarmdatawaterline_fuzzer/hcwarmdatawaterline_fuzzer.cpp +++ b/test/fuzztest/hc_node/hcwarmdatawaterline_fuzzer/hcwarmdatawaterline_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_WARM_DATA_WATERLINE = "/sys/fs/f2fs/loop1/hc_warm_data_waterline"; diff --git a/test/fuzztest/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp b/test/fuzztest/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp index e5d3b23..075d978 100644 --- a/test/fuzztest/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp +++ b/test/fuzztest/hc_node/hcwarmnodelowerlimit_fuzzer/hcwarmnodelowerlimit_fuzzer.cpp @@ -14,12 +14,11 @@ */ #include -#include -#include -#include -#include #include #include +#include +#include +#include const char *HC_WARM_NODE_LOWER_LIMIT = "/sys/fs/f2fs/loop1/hc_warm_node_lower_limit"; diff --git a/test/fuzztest/memory/BUILD.gn b/test/fuzztest/memory/BUILD.gn new file mode 100644 index 0000000..c609e06 --- /dev/null +++ b/test/fuzztest/memory/BUILD.gn @@ -0,0 +1,38 @@ +# Copyright (c) 2022 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. + +group("fuzztest") { + testonly = true + deps = [] + + deps += [ + "anonrefaultsnapshotmininterval_fuzzer:AnonRefaultSnapshotMinIntervalFuzzTest", + "appscore_fuzzer:AppScoreFuzzTest", + "areaanonrefaultthreshold_fuzzer:AreaAnonRefaultThresholdFuzzTest", + "availbuffers_fuzzer:AvailBuffersFuzzTest", + "bufferratioparams_fuzzer:BufferRatioParamsFuzzTest", + "compressratio_fuzzer:CompressRatioFuzzTest", + "emptyroundcheckthreshold_fuzzer:EmptyRoundCheckThresholdFuzzTest", + "emptyroundskipinterval_fuzzer:EmptyRoundSkipIntervalFuzzTest", + "forceshrinkanon_fuzzer:ForceShrinkAnonFuzzTest", + "maxskipinterval_fuzzer:MaxSkipIntervalFuzzTest", + "name_fuzzer:NameFuzzTest", + "ubufs2zramratio_fuzzer:UbUfs2zramRatioFuzzTest", + "zramcriticalthreshold_fuzzer:ZramCriticalThresholdFuzzTest", + "zramwmratio_fuzzer:ZramWmRatioFuzzTest", + "zswapdmaxreclaimsize_fuzzer:ZswapdMaxReclaimSizeFuzzTest", + "zswapdmemcgsparam_fuzzer:ZswapdMemcgsparamFuzzTest", + "zswapdpressureshow_fuzzer:ZswapdPressureShowFuzzTest", + "zswapdsinglememcgparam_fuzzer:ZswapdSingleMemcgParamFuzzTest", + ] +} diff --git a/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/BUILD.gn b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/BUILD.gn new file mode 100644 index 0000000..1728b29 --- /dev/null +++ b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("AnonRefaultSnapshotMinIntervalFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//kernel/linux/build/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "anonrefaultsnapshotmininterval_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":AnonRefaultSnapshotMinIntervalFuzzTest" ] +} diff --git a/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/anonrefaultsnapshotmininterval_fuzzer.cpp b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/anonrefaultsnapshotmininterval_fuzzer.cpp new file mode 100644 index 0000000..3d35b90 --- /dev/null +++ b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/anonrefaultsnapshotmininterval_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ANON_REFAULT_SNAPSHOT_MIN_INTERVAL = "/dev/memcg/memory.anon_refault_snapshot_min_interval"; + +namespace OHOS { +bool AnonRefaultSnapshotMinIntervalFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ANON_REFAULT_SNAPSHOT_MIN_INTERVAL, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ANON_REFAULT_SNAPSHOT_MIN_INTERVAL); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::AnonRefaultSnapshotMinIntervalFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/corpus/init b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/project.xml b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/anonrefaultsnapshotmininterval_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/appscore_fuzzer/BUILD.gn b/test/fuzztest/memory/appscore_fuzzer/BUILD.gn new file mode 100644 index 0000000..33b823b --- /dev/null +++ b/test/fuzztest/memory/appscore_fuzzer/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("AppScoreFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//kernel/linux/build/test/fuzztest/memory/appscore_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "appscore_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":AppScoreFuzzTest" ] +} diff --git a/test/fuzztest/memory/appscore_fuzzer/appscore_fuzzer.cpp b/test/fuzztest/memory/appscore_fuzzer/appscore_fuzzer.cpp new file mode 100644 index 0000000..1896d1b --- /dev/null +++ b/test/fuzztest/memory/appscore_fuzzer/appscore_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *APP_SCORE = "/dev/memcg/memory.app_score"; + +namespace OHOS { +bool AppScoreFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(APP_SCORE, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", APP_SCORE); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::AppScoreFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/appscore_fuzzer/corpus/init b/test/fuzztest/memory/appscore_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/appscore_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/appscore_fuzzer/project.xml b/test/fuzztest/memory/appscore_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/appscore_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/BUILD.gn b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/BUILD.gn new file mode 100644 index 0000000..c7fc1a3 --- /dev/null +++ b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("AreaAnonRefaultThresholdFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//kernel/linux/build/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "areaanonrefaultthreshold_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":AreaAnonRefaultThresholdFuzzTest" ] +} diff --git a/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/areaanonrefaultthreshold_fuzzer.cpp b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/areaanonrefaultthreshold_fuzzer.cpp new file mode 100644 index 0000000..fbe1e3c --- /dev/null +++ b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/areaanonrefaultthreshold_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *AREA_ANON_REFAULT_THRESHOLD = "/dev/memcg/memory.area_anon_refault_threshold"; + +namespace OHOS { +bool AreaAnonRefaultThresholdFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(AREA_ANON_REFAULT_THRESHOLD, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", AREA_ANON_REFAULT_THRESHOLD); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::AreaAnonRefaultThresholdFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/corpus/init b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/project.xml b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/areaanonrefaultthreshold_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/availbuffers_fuzzer/BUILD.gn b/test/fuzztest/memory/availbuffers_fuzzer/BUILD.gn new file mode 100644 index 0000000..23dc1c7 --- /dev/null +++ b/test/fuzztest/memory/availbuffers_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("AvailBuffersFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/availbuffers_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "availbuffers_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":AvailBuffersFuzzTest" ] +} diff --git a/test/fuzztest/memory/availbuffers_fuzzer/availbuffers_fuzzer.cpp b/test/fuzztest/memory/availbuffers_fuzzer/availbuffers_fuzzer.cpp new file mode 100644 index 0000000..54ceadd --- /dev/null +++ b/test/fuzztest/memory/availbuffers_fuzzer/availbuffers_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *AVAIL_BUFFERS = "/dev/memcg/memory.avail_buffers"; + +namespace OHOS { +bool AvailBuffersFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(AVAIL_BUFFERS, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", AVAIL_BUFFERS); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::AvailBuffersFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/availbuffers_fuzzer/corpus/init b/test/fuzztest/memory/availbuffers_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/availbuffers_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/availbuffers_fuzzer/project.xml b/test/fuzztest/memory/availbuffers_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/availbuffers_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/bufferratioparams_fuzzer/BUILD.gn b/test/fuzztest/memory/bufferratioparams_fuzzer/BUILD.gn new file mode 100644 index 0000000..323a77e --- /dev/null +++ b/test/fuzztest/memory/bufferratioparams_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("BufferRatioParamsFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/bufferratioparams_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "bufferratioparams_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":BufferRatioParamsFuzzTest" ] +} diff --git a/test/fuzztest/memory/bufferratioparams_fuzzer/bufferratioparams_fuzzer.cpp b/test/fuzztest/memory/bufferratioparams_fuzzer/bufferratioparams_fuzzer.cpp new file mode 100644 index 0000000..e05a1b6 --- /dev/null +++ b/test/fuzztest/memory/bufferratioparams_fuzzer/bufferratioparams_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *BUFFER_RATIO_PARAMS = "/dev/memcg/memory.buffer_ratio_params"; + +namespace OHOS { +bool BufferRatioParamsFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(BUFFER_RATIO_PARAMS, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", BUFFER_RATIO_PARAMS); + close(fd); + return false; + } + + ret = write(fd, data, sizeof(uint8_t)); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::BufferRatioParamsFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/bufferratioparams_fuzzer/corpus/init b/test/fuzztest/memory/bufferratioparams_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/bufferratioparams_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/bufferratioparams_fuzzer/project.xml b/test/fuzztest/memory/bufferratioparams_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/bufferratioparams_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/compressratio_fuzzer/BUILD.gn b/test/fuzztest/memory/compressratio_fuzzer/BUILD.gn new file mode 100644 index 0000000..019dd38 --- /dev/null +++ b/test/fuzztest/memory/compressratio_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("CompressRatioFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/compressratio_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "compressratio_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":CompressRatioFuzzTest" ] +} diff --git a/test/fuzztest/memory/compressratio_fuzzer/compressratio_fuzzer.cpp b/test/fuzztest/memory/compressratio_fuzzer/compressratio_fuzzer.cpp new file mode 100644 index 0000000..44a5437 --- /dev/null +++ b/test/fuzztest/memory/compressratio_fuzzer/compressratio_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *COMPRESS_RATIO = "/dev/memcg/memory.compress_ratio"; + +namespace OHOS { +bool CompressRatioFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(COMPRESS_RATIO, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", COMPRESS_RATIO); + close(fd); + return false; + } + + ret = write(fd, data, sizeof(uint8_t)); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::CompressRatioFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/compressratio_fuzzer/corpus/init b/test/fuzztest/memory/compressratio_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/compressratio_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/compressratio_fuzzer/project.xml b/test/fuzztest/memory/compressratio_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/compressratio_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/BUILD.gn b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/BUILD.gn new file mode 100644 index 0000000..7afade9 --- /dev/null +++ b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("EmptyRoundCheckThresholdFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//kernel/linux/build/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "emptyroundcheckthreshold_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":EmptyRoundCheckThresholdFuzzTest" ] +} diff --git a/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/corpus/init b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/emptyroundcheckthreshold_fuzzer.cpp b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/emptyroundcheckthreshold_fuzzer.cpp new file mode 100644 index 0000000..a57895a --- /dev/null +++ b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/emptyroundcheckthreshold_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *EMPTY_ROUND_CHECK_THRESHOLD = "/dev/memcg/memory.empty_round_check_threshold"; + +namespace OHOS { +bool EmptyRoundCheckThresholdFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(EMPTY_ROUND_CHECK_THRESHOLD, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", EMPTY_ROUND_CHECK_THRESHOLD); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::EmptyRoundCheckThresholdFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/project.xml b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/emptyroundcheckthreshold_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/emptyroundskipinterval_fuzzer/BUILD.gn b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/BUILD.gn new file mode 100644 index 0000000..4d456e8 --- /dev/null +++ b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("EmptyRoundSkipIntervalFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/emptyroundskipinterval_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "emptyroundskipinterval_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":EmptyRoundSkipIntervalFuzzTest" ] +} diff --git a/test/fuzztest/memory/emptyroundskipinterval_fuzzer/corpus/init b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/emptyroundskipinterval_fuzzer/emptyroundskipinterval_fuzzer.cpp b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/emptyroundskipinterval_fuzzer.cpp new file mode 100644 index 0000000..787aa5f --- /dev/null +++ b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/emptyroundskipinterval_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *EMPTY_ROUND_SKIP_INTERVAL = "/dev/memcg/memory.empty_round_skip_interval"; + +namespace OHOS { +bool EmptyRoundSkipIntervalFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(EMPTY_ROUND_SKIP_INTERVAL, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", EMPTY_ROUND_SKIP_INTERVAL); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::EmptyRoundSkipIntervalFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/emptyroundskipinterval_fuzzer/project.xml b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/emptyroundskipinterval_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/forceshrinkanon_fuzzer/BUILD.gn b/test/fuzztest/memory/forceshrinkanon_fuzzer/BUILD.gn new file mode 100644 index 0000000..08e9c7a --- /dev/null +++ b/test/fuzztest/memory/forceshrinkanon_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ForceShrinkAnonFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/forceshrinkanon_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "forceshrinkanon_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ForceShrinkAnonFuzzTest" ] +} diff --git a/test/fuzztest/memory/forceshrinkanon_fuzzer/corpus/init b/test/fuzztest/memory/forceshrinkanon_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/forceshrinkanon_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/forceshrinkanon_fuzzer/forceshrinkanon_fuzzer.cpp b/test/fuzztest/memory/forceshrinkanon_fuzzer/forceshrinkanon_fuzzer.cpp new file mode 100644 index 0000000..6725fe7 --- /dev/null +++ b/test/fuzztest/memory/forceshrinkanon_fuzzer/forceshrinkanon_fuzzer.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *FORCE_SHRINK_ANON = "/dev/memcg/memory.force_shrink_anon"; + +namespace OHOS { +bool ForceShrinkAnonFuzzer(const uint8_t *data, size_t size) +{ + int fd = open(FORCE_SHRINK_ANON, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = write(fd, data, size); + if (ret < 0) { + printf("%s write fail\n", FORCE_SHRINK_ANON); + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ForceShrinkAnonFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/forceshrinkanon_fuzzer/project.xml b/test/fuzztest/memory/forceshrinkanon_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/forceshrinkanon_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/maxskipinterval_fuzzer/BUILD.gn b/test/fuzztest/memory/maxskipinterval_fuzzer/BUILD.gn new file mode 100644 index 0000000..f5273cd --- /dev/null +++ b/test/fuzztest/memory/maxskipinterval_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("MaxSkipIntervalFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/maxskipinterval_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "maxskipinterval_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":MaxSkipIntervalFuzzTest" ] +} diff --git a/test/fuzztest/memory/maxskipinterval_fuzzer/corpus/init b/test/fuzztest/memory/maxskipinterval_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/maxskipinterval_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/maxskipinterval_fuzzer/maxskipinterval_fuzzer.cpp b/test/fuzztest/memory/maxskipinterval_fuzzer/maxskipinterval_fuzzer.cpp new file mode 100644 index 0000000..f87096b --- /dev/null +++ b/test/fuzztest/memory/maxskipinterval_fuzzer/maxskipinterval_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *MAX_SKIP_INTERVAL = "/dev/memcg/memory.max_skip_interval"; + +namespace OHOS { +bool MaxSkipIntervalFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(MAX_SKIP_INTERVAL, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", MAX_SKIP_INTERVAL); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::MaxSkipIntervalFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/maxskipinterval_fuzzer/project.xml b/test/fuzztest/memory/maxskipinterval_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/maxskipinterval_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/name_fuzzer/BUILD.gn b/test/fuzztest/memory/name_fuzzer/BUILD.gn new file mode 100644 index 0000000..b49cc4e --- /dev/null +++ b/test/fuzztest/memory/name_fuzzer/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("NameFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = "//kernel/linux/build/test/fuzztest/memory/name_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "name_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":NameFuzzTest" ] +} diff --git a/test/fuzztest/memory/name_fuzzer/corpus/init b/test/fuzztest/memory/name_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/name_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/name_fuzzer/name_fuzzer.cpp b/test/fuzztest/memory/name_fuzzer/name_fuzzer.cpp new file mode 100644 index 0000000..d8fe0e5 --- /dev/null +++ b/test/fuzztest/memory/name_fuzzer/name_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *NAME = "/dev/memcg/memory.name"; + +namespace OHOS { +bool NameFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(NAME, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", NAME); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::NameFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/name_fuzzer/project.xml b/test/fuzztest/memory/name_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/name_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/ubufs2zramratio_fuzzer/BUILD.gn b/test/fuzztest/memory/ubufs2zramratio_fuzzer/BUILD.gn new file mode 100644 index 0000000..88cd1ae --- /dev/null +++ b/test/fuzztest/memory/ubufs2zramratio_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("UbUfs2zramRatioFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/ubufs2zramratio_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "ubufs2zramratio_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":UbUfs2zramRatioFuzzTest" ] +} diff --git a/test/fuzztest/memory/ubufs2zramratio_fuzzer/corpus/init b/test/fuzztest/memory/ubufs2zramratio_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/ubufs2zramratio_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/ubufs2zramratio_fuzzer/project.xml b/test/fuzztest/memory/ubufs2zramratio_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/ubufs2zramratio_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/ubufs2zramratio_fuzzer/ubufs2zramratio_fuzzer.cpp b/test/fuzztest/memory/ubufs2zramratio_fuzzer/ubufs2zramratio_fuzzer.cpp new file mode 100644 index 0000000..a8ab055 --- /dev/null +++ b/test/fuzztest/memory/ubufs2zramratio_fuzzer/ubufs2zramratio_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *UB_UFS2ZRAM_RATIO = "/dev/memcg/memory.ub_ufs2zram_ratio"; + +namespace OHOS { +bool UbUfs2zramRatioFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(UB_UFS2ZRAM_RATIO, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", UB_UFS2ZRAM_RATIO); + close(fd); + return false; + } + + ret = write(fd, data, sizeof(uint8_t)); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::UbUfs2zramRatioFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/zramcriticalthreshold_fuzzer/BUILD.gn b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/BUILD.gn new file mode 100644 index 0000000..6c3c462 --- /dev/null +++ b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ZramCriticalThresholdFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/zramcriticalthreshold_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "zramcriticalthreshold_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ZramCriticalThresholdFuzzTest" ] +} diff --git a/test/fuzztest/memory/zramcriticalthreshold_fuzzer/corpus/init b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/zramcriticalthreshold_fuzzer/project.xml b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/zramcriticalthreshold_fuzzer/zramcriticalthreshold_fuzzer.cpp b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/zramcriticalthreshold_fuzzer.cpp new file mode 100644 index 0000000..5fc1675 --- /dev/null +++ b/test/fuzztest/memory/zramcriticalthreshold_fuzzer/zramcriticalthreshold_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ZRAM_CRITICAL_THRESHOLD = "/dev/memcg/memory.zram_critical_threshold"; + +namespace OHOS { +bool ZramCriticalThresholdFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ZRAM_CRITICAL_THRESHOLD, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ZRAM_CRITICAL_THRESHOLD); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ZramCriticalThresholdFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/zramwmratio_fuzzer/BUILD.gn b/test/fuzztest/memory/zramwmratio_fuzzer/BUILD.gn new file mode 100644 index 0000000..981da10 --- /dev/null +++ b/test/fuzztest/memory/zramwmratio_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ZramWmRatioFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/zramwmratio_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "zramwmratio_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ZramWmRatioFuzzTest" ] +} diff --git a/test/fuzztest/memory/zramwmratio_fuzzer/corpus/init b/test/fuzztest/memory/zramwmratio_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/zramwmratio_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/zramwmratio_fuzzer/project.xml b/test/fuzztest/memory/zramwmratio_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/zramwmratio_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/zramwmratio_fuzzer/zramwmratio_fuzzer.cpp b/test/fuzztest/memory/zramwmratio_fuzzer/zramwmratio_fuzzer.cpp new file mode 100644 index 0000000..3560005 --- /dev/null +++ b/test/fuzztest/memory/zramwmratio_fuzzer/zramwmratio_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ZRAM_WR_RATIO = "/dev/memcg/memory.zram_wm_ratio"; + +namespace OHOS { +bool ZramWmRatioFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ZRAM_WR_RATIO, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ZRAM_WR_RATIO); + close(fd); + return false; + } + + ret = write(fd, data, sizeof(uint8_t)); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ZramWmRatioFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/BUILD.gn b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/BUILD.gn new file mode 100644 index 0000000..93a7875 --- /dev/null +++ b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ZswapdMaxReclaimSizeFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "zswapdmaxreclaimsize_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ZswapdMaxReclaimSizeFuzzTest" ] +} diff --git a/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/corpus/init b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/project.xml b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/zswapdmaxreclaimsize_fuzzer.cpp b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/zswapdmaxreclaimsize_fuzzer.cpp new file mode 100644 index 0000000..6697c5c --- /dev/null +++ b/test/fuzztest/memory/zswapdmaxreclaimsize_fuzzer/zswapdmaxreclaimsize_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ZSWAPD_MAX_RECLAIM_SIZE = "/dev/memcg/memory.zswapd_max_reclaim_size"; + +namespace OHOS { +bool ZswapdMaxReclaimSizeFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ZSWAPD_MAX_RECLAIM_SIZE, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ZSWAPD_MAX_RECLAIM_SIZE); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ZswapdMaxReclaimSizeFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/BUILD.gn b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/BUILD.gn new file mode 100644 index 0000000..64fd1c4 --- /dev/null +++ b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ZswapdMemcgsparamFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/zswapdmemcgsparam_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "zswapdmemcgsparam_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ZswapdMemcgsparamFuzzTest" ] +} diff --git a/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/corpus/init b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/project.xml b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/zswapdmemcgsparam_fuzzer.cpp b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/zswapdmemcgsparam_fuzzer.cpp new file mode 100644 index 0000000..7b35774 --- /dev/null +++ b/test/fuzztest/memory/zswapdmemcgsparam_fuzzer/zswapdmemcgsparam_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ZSWAPD_MEMCGS_PARAM = "/dev/memcg/memory.zswapd_memcgs_param"; + +namespace OHOS { +bool ZswapdMemcgsParamFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ZSWAPD_MEMCGS_PARAM, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ZSWAPD_MEMCGS_PARAM); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ZswapdMemcgsParamFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/zswapdpressureshow_fuzzer/BUILD.gn b/test/fuzztest/memory/zswapdpressureshow_fuzzer/BUILD.gn new file mode 100644 index 0000000..c12a1bb --- /dev/null +++ b/test/fuzztest/memory/zswapdpressureshow_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ZswapdPressureShowFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/zswapdpressureshow_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "zswapdpressureshow_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ZswapdPressureShowFuzzTest" ] +} diff --git a/test/fuzztest/memory/zswapdpressureshow_fuzzer/corpus/init b/test/fuzztest/memory/zswapdpressureshow_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/zswapdpressureshow_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/zswapdpressureshow_fuzzer/project.xml b/test/fuzztest/memory/zswapdpressureshow_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/zswapdpressureshow_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/zswapdpressureshow_fuzzer/zswapdpressureshow_fuzzer.cpp b/test/fuzztest/memory/zswapdpressureshow_fuzzer/zswapdpressureshow_fuzzer.cpp new file mode 100644 index 0000000..8dfcd24 --- /dev/null +++ b/test/fuzztest/memory/zswapdpressureshow_fuzzer/zswapdpressureshow_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ZSWAPD_PRESSURE_SHOW = "/dev/memcg/memory.zswapd_pressure_show"; + +namespace OHOS { +bool ZswapdPressureShowFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ZSWAPD_PRESSURE_SHOW, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ZSWAPD_PRESSURE_SHOW); + close(fd); + return false; + } + + ret = write(fd, data, sizeof(uint8_t)); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ZswapdPressureShowFuzzer(data, size); + return 0; +} diff --git a/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/BUILD.gn b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/BUILD.gn new file mode 100644 index 0000000..6a8459e --- /dev/null +++ b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2022 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. + +import("//build/config/features.gni") +import("//build/test.gni") + +module_output_path = "linuxkerneltest/memory" + +ohos_fuzztest("ZswapdSingleMemcgParamFuzzTest") { + module_out_path = module_output_path + fuzz_config_file = + "//kernel/linux/build/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer" + + cflags = [ + "-g", + "-O0", + "-Wno-unused-variable", + "-fno-omit-frame-pointer", + ] + sources = [ "zswapdsinglememcgparam_fuzzer.cpp" ] +} + +group("fuzztest") { + testonly = true + deps = [] + deps += [ ":ZswapdSingleMemcgParamFuzzTest" ] +} diff --git a/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/corpus/init b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/corpus/init new file mode 100644 index 0000000..6703f24 --- /dev/null +++ b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/corpus/init @@ -0,0 +1,13 @@ +# Copyright (c) 2020-2022 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. +FUZZ \ No newline at end of file diff --git a/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/project.xml b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/project.xml new file mode 100644 index 0000000..6e8ad2c --- /dev/null +++ b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/project.xml @@ -0,0 +1,25 @@ + + + + + + 1000 + + 300 + + 4096 + + diff --git a/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/zswapdsinglememcgparam_fuzzer.cpp b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/zswapdsinglememcgparam_fuzzer.cpp new file mode 100644 index 0000000..8e7c735 --- /dev/null +++ b/test/fuzztest/memory/zswapdsinglememcgparam_fuzzer/zswapdsinglememcgparam_fuzzer.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +const char *ZSWAPD_SINGLE_MEMCG_PARAM = "/dev/memcg/memory.zswapd_single_memcg_param"; + +namespace OHOS { +bool ZswapdSingleMemcgParamFuzzer(const uint8_t *data, size_t size) +{ + uint32_t value = 0; + + int fd = open(ZSWAPD_SINGLE_MEMCG_PARAM, O_RDWR); + if (fd < 0) { + return false; + } + + int ret = read(fd, &value, sizeof(value)); + if (ret < 0) { + printf("%s read fail\n", ZSWAPD_SINGLE_MEMCG_PARAM); + close(fd); + return false; + } + + ret = write(fd, data, size); + if (ret < 0) { + close(fd); + return false; + } + + close(fd); + return true; +} +} // namespace OHOS + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) +{ + OHOS::ZswapdSingleMemcgParamFuzzer(data, size); + return 0; +} diff --git a/test/moduletest/runtest/bin/cpuisolation_t/testcases/bin/cpuisolation03.sh b/test/moduletest/runtest/bin/cpuisolation_t/testcases/bin/cpuisolation03.sh index f327f9a..29c953b 100644 --- a/test/moduletest/runtest/bin/cpuisolation_t/testcases/bin/cpuisolation03.sh +++ b/test/moduletest/runtest/bin/cpuisolation_t/testcases/bin/cpuisolation03.sh @@ -224,7 +224,7 @@ active_cpu_online() isolated_num3=$(( $isolated_num3 + 1 )) done if [ $isolated_num3 -eq 2 ]; then - tst_res TPASS "isolated number doesnt change." + tst_res TPASS "isolated number does not change." else tst_res TFAIL "isolated number had been changed." fi @@ -243,4 +243,4 @@ do_clean() do_setup do_test do_clean -tst_exit \ No newline at end of file +tst_exit diff --git a/test/moduletest/runtest/bin/enhancedswap_t_init.sh b/test/moduletest/runtest/bin/enhancedswap_t_init.sh index 4dcadcf..404136d 100644 --- a/test/moduletest/runtest/bin/enhancedswap_t_init.sh +++ b/test/moduletest/runtest/bin/enhancedswap_t_init.sh @@ -30,12 +30,24 @@ pre_condition() } +uninit_platform() +{ + losetup -d /dev/block/loop7 + echo ${hyperhold_device} > /proc/sys/kernel/hyperhold/device + echo ${hyperhold_enable} > /proc/sys/kernel/hyperhold/enable + echo ${zram0_group} > /sys/block/zram0/group + echo ${zram0_disksize} > /sys/block/zram0/disksize + rm -rf hpdisk + swapoff /dev/block/zram0 + echo 1 > /sys/block/zram0/reset +} + hp_init() { dd if=/dev/random of=hpdisk bs=4096 count=131072 - losetup /dev/block/loop6 hpdisk + losetup /dev/block/loop7 hpdisk hyperhold_device=$(cat /proc/sys/kernel/hyperhold/device) - echo /dev/block/loop6 > /proc/sys/kernel/hyperhold/device + echo /dev/block/loop7 > /proc/sys/kernel/hyperhold/device } hp_enable() @@ -58,14 +70,19 @@ zram_enable() swapon /dev/block/zram0 aa start -b com.ohos.settings -a com.ohos.settings.MainAbility aa start -b ohos.samples.airquality -a ohos.samples.airquality.default - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility aa start -b ohos.samples.flashlight -a ohos.samples.flashlight.default aa start -b ohos.samples.clock -a ohos.samples.clock.default + aa start -b com.ohos.camera -a com.ohos.camera.MainAbility + aa start -b com.ohos.permissionmanager -a com.ohos.permissionmanager.MainAbility + aa start -b ohos.sample.shopping -a com.example.entry.MainAbility + aa start -b ohos.samples.distributedcalc -a ohos.samples.distributedcalc.MainAbility } echo "***************************ESWAP INIT START***************************" free -m +uninit_platform pre_condition hp_init hp_enable diff --git a/test/moduletest/runtest/bin/enhancedswap_t_uninit.sh b/test/moduletest/runtest/bin/enhancedswap_t_uninit.sh index e7a5e60..6236024 100644 --- a/test/moduletest/runtest/bin/enhancedswap_t_uninit.sh +++ b/test/moduletest/runtest/bin/enhancedswap_t_uninit.sh @@ -27,7 +27,7 @@ uninit_platform() { - losetup -d /dev/block/loop6 + losetup -d /dev/block/loop7 echo ${hyperhold_device} > /proc/sys/kernel/hyperhold/device echo ${hyperhold_enable} > /proc/sys/kernel/hyperhold/enable echo ${zram0_group} > /sys/block/zram0/group diff --git a/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug04.sh b/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug04.sh index cdfcb09..fabc90e 100644 --- a/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug04.sh +++ b/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug04.sh @@ -56,7 +56,7 @@ do_test() sh ../../../mem_debug_t_init.sh aa start -b com.ohos.settings -a com.ohos.settings.MainAbility aa start -b ohos.samples.airquality -a ohos.samples.airquality.default - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility aa start -b ohos.samples.flashlight -a ohos.samples.flashlight.default aa start -b ohos.samples.clock -a ohos.samples.clock.default diff --git a/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug08.sh b/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug08.sh index d3a3dc3..f20b0c9 100644 --- a/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug08.sh +++ b/test/moduletest/runtest/bin/mem_debug_t/testcases/bin/mem_debug08.sh @@ -33,13 +33,35 @@ do_setup() do_test() { - local pid=$(ps -ef | grep "com.ohos.launch" | grep -v grep | awk '{print $2}') + # find ashmem process + local pid=$(cat /proc/ashmem_process_info | awk 'NR>3 && $2!="" {print $2}' | sort -u) + local line=$(cat /proc/ashmem_process_info | awk 'NR>3 && $2!="" {print $2}' | sort -u | wc -l) + if [ $line -eq 0 ]; then + tst_res TFAIL "Cannot find program with ashmen!" + else + tst_res TPASS "The following $line ashmem processes have been found(PID): $pid." + fi + + # Confirm that each process ashmem information is correct + for p in $pid + do + tst_res TINFO "now going to check $p ashmem information" + ash_info_check $p + done + +} + +ash_info_check() +{ + local pid=$1 + tst_res TINFO "pid is $pid ." + local ashmem_info_lines=$(cat /proc/$pid/smaps | grep ashmem | wc -l) if [ $ashmem_info_lines -le 0 ]; then - tst_res TFAIL "Ashmem information display test failed!" + tst_res TFAIL "Cannot find ashmem information of $pid .Ashmem information display test failed!" else - tst_res TPASS "Ashmem information display test pass." + tst_res TPASS "$pid totally found $ashmem_info_lines ashmem messages.Ashmem information display test pass." fi } diff --git a/test/moduletest/runtest/bin/mem_debug_t_init.sh b/test/moduletest/runtest/bin/mem_debug_t_init.sh index 91474c8..1455628 100644 --- a/test/moduletest/runtest/bin/mem_debug_t_init.sh +++ b/test/moduletest/runtest/bin/mem_debug_t_init.sh @@ -58,7 +58,7 @@ zram_enable() swapon /dev/block/zram0 aa start -b com.ohos.settings -a com.ohos.settings.MainAbility aa start -b ohos.samples.airquality -a ohos.samples.airquality.default - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility aa start -b ohos.samples.flashlight -a ohos.samples.flashlight.default aa start -b ohos.samples.clock -a ohos.samples.clock.default } diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg01.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg01.sh index 267a0c8..6f273c1 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg01.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg01.sh @@ -29,7 +29,7 @@ source tst_oh.sh do_setup() { - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility sleep 1 PID=$(ps -ef | grep ohos.samples.ecg | grep -v grep | awk '{print $2}') } diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg02.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg02.sh index 8ab1532..631283d 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg02.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg02.sh @@ -31,7 +31,7 @@ source tst_oh.sh do_setup() { - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility sleep 1 PID=$(ps -ef | grep ohos.samples.ecg | grep -v grep | awk '{print $2}') } diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg03.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg03.sh index 6c53aeb..d9f1a6a 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg03.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg03.sh @@ -29,7 +29,7 @@ source tst_oh.sh do_setup() { - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility sleep 1 PID=$(ps -ef | grep ohos.samples.ecg | grep -v grep | awk '{print $2}') } diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh index cb76fa1..0f77902 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg04.sh @@ -29,18 +29,12 @@ source tst_oh.sh do_setup() { - frame_value=$(cat /sys/kernel/debug/tracing/events/rtg/rtg_frame_sched/enable) - task_value=$(cat /sys/kernel/debug/tracing/events/rtg/sched_rtg_task_each/enable) cpu_value=$(cat /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable) - normalized_value=$(cat /sys/kernel/debug/tracing/events/rtg/sched_rtg_valid_normalized_util/enable) - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility sleep 1 PID=$(ps -ef | grep ohos.samples.ecg | grep -v grep | awk '{print $2}') - echo 1 > /sys/kernel/debug/tracing/events/rtg/rtg_frame_sched/enable - echo 1 > /sys/kernel/debug/tracing/events/rtg/sched_rtg_task_each/enable echo 1 > /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable - echo 1 > /sys/kernel/debug/tracing/events/rtg/sched_rtg_valid_normalized_util/enable } do_test() @@ -57,9 +51,7 @@ do_test() echo 2 > $sched_group_id done sleep 50 - cat rtgtrace.ftrace | grep "sched_rtg_task_each" && - cat rtgtrace.ftrace | grep "find_rtg_cpu" && - cat rtgtrace.ftrace | grep "sched_rtg_valid_normalized_util" + cat rtgtrace.ftrace | grep "find_rtg_cpu" if [ $? -eq 0 ]; then tst_res TPASS "trace info found." rm -rf rtgtrace.ftrace @@ -70,10 +62,7 @@ do_test() do_clean() { - echo $frame_value > /sys/kernel/debug/tracing/events/rtg/rtg_frame_sched/enable && - echo $task_value > /sys/kernel/debug/tracing/events/rtg/sched_rtg_task_each/enable && - echo $cpu_value > /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable && - echo $normalized_value > /sys/kernel/debug/tracing/events/rtg/sched_rtg_valid_normalized_util/enable + echo $cpu_value > /sys/kernel/debug/tracing/events/rtg/find_rtg_cpu/enable aa force-stop ohos.samples.ecg } diff --git a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh index 5066832..91a3014 100644 --- a/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh +++ b/test/moduletest/runtest/bin/sched_rtg_t/testcases/bin/sched_rtg06.sh @@ -66,7 +66,7 @@ stability_test() ps -ef | grep "create_process" | grep -v "grep" | grep -v ${PPID} | cut -c 9-18 | xargs kill -9 sleep 5 tst_res TINFO "kill process successed." - aa start -b ohos.samples.ecg -a ohos.samples.ecg.default && + aa start -b ohos.samples.ecg -a ohos.samples.ecg.MainAbility && sleep 1 && PID=$(ps -ef | grep ohos.samples.ecg | grep -v grep | awk '{print $2}') if [ $? -eq 0 ]; then diff --git a/test/unittest/accesstokenid/accesstokenid_test.cpp b/test/unittest/accesstokenid/accesstokenid_test.cpp index ae75dec..abdfd47 100644 --- a/test/unittest/accesstokenid/accesstokenid_test.cpp +++ b/test/unittest/accesstokenid/accesstokenid_test.cpp @@ -321,7 +321,7 @@ HWTEST_F(AccesstokenidTest, CheckChildThreadInheritance, Function | MediumTest | /** * @tc.name: CheckChildThreadSetIndepent - * @tc.desc: Test each child thread tokenid and ftokenid is indepent + * @tc.desc: Test each child thread tokenid and ftokenid is independent * @tc.desc: The tokenid and ftokenid of each child thread not equal to father process * @tc.type: FUNC */