diff --git a/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control01.sh b/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control01.sh new file mode 100644 index 0000000000000000000000000000000000000000..f2614fc287e5470646b730946761ef02a7eb5a90 --- /dev/null +++ b/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control01.sh @@ -0,0 +1,51 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# SPDX-License-Identifier: GPL-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. +# +################################################################################ +# File: memory_control01.sh +# +# Description: Verify /dev/memcg/memory.app_score +# +# Authors: Wu Lisai - wulisai@huawei-partners.com +# +# History: Nov 18 2022 - init scripts +# +################################################################################ +source tst_oh.sh + +do_setup() +{ + zcat /proc/config.gz | grep CONFIG_HYPERHOLD_MEMCG=y || tst_res TCONF "CONFIG_HYPERHOLD_MEMCG=y not satisfied!" +} + +do_test() +{ + tst_res TINFO "Start to verify mem ." + + mem=$(cat /dev/memcg/memory.app_score) + echo $mem + if [ "$mem"x = "300"x ]; then + tst_res TPASS "memory.app_score value correct." + else + tst_res TFAIL "memory.app_score value incorrect." + fi +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit diff --git a/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control02.sh b/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control02.sh new file mode 100644 index 0000000000000000000000000000000000000000..95ae4facfc45b54ad94014c0c32f9af58e1f077a --- /dev/null +++ b/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control02.sh @@ -0,0 +1,52 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# SPDX-License-Identifier: GPL-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. +# +################################################################################ +# File: memory_control02.sh +# +# Description: Verify /dev/memcg/memory.ub_ufs2zram_ratio +# +# Authors: Wu Lisai - wulisai@huawei-partners.com +# +# History: Nov 18 2022 - init scripts +# +################################################################################ +source tst_oh.sh + +do_setup() +{ + zcat /proc/config.gz | grep CONFIG_HYPERHOLD_MEMCG=y || tst_res TCONF "CONFIG_HYPERHOLD_MEMCG=y not satisfied!" +} + +do_test() +{ + tst_res TINFO "Start to verify mem ." + + mem=$(cat /dev/memcg/memory.ub_ufs2zram_ratio) + + if [ "$mem"x = "0"x ]; then + tst_res TPASS "memory_control default value correct." + else + tst_res TFAIL "memory_control default value incorrect." + fi + +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit diff --git a/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control03.sh b/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control03.sh new file mode 100644 index 0000000000000000000000000000000000000000..41b14b1738b9fe125b08b33551d389c4f4f0d040 --- /dev/null +++ b/test/moduletest/runtest/bin/memorycontrol_t/testcases/bin/memory_control03.sh @@ -0,0 +1,52 @@ +#!/bin/sh +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# SPDX-License-Identifier: GPL-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. +# +################################################################################ +# File: memory_control03.sh +# +# Description: Verify /dev/memcg/memory.name +# +# Authors: Wu Lisai - wulisai@huawei-partners.com +# +# History: Nov 18 2022 - init scripts +# +################################################################################ +source tst_oh.sh + +do_setup() +{ + zcat /proc/config.gz | grep CONFIG_HYPERHOLD_MEMCG=y || tst_res TCONF "CONFIG_HYPERHOLD_MEMCG=y not satisfied!" +} + +do_test() +{ + tst_res TINFO "Start to verify mem ." + + echo "test_cgroup" > /dev/memcg/memory.name + mem=$(cat /dev/memcg/memory.name) + echo $mem + if [ "$mem"x = "test_cgroup"x ]; then + tst_res TPASS "memory_control default value correct." + else + tst_res TFAIL "memory_control default value incorrect." + fi +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit diff --git a/test/moduletest/runtest/conf/OH_RK3568_config b/test/moduletest/runtest/conf/OH_RK3568_config index 8d0d14382a60c4450db7c9b00130b05b702f76b8..6daf8761131644cdd8315d69318311cfac5fd5a9 100644 --- a/test/moduletest/runtest/conf/OH_RK3568_config +++ b/test/moduletest/runtest/conf/OH_RK3568_config @@ -31,3 +31,4 @@ enhancedf2fs_t mem_debug_t rss_monitor_t purgeable_t +memorycontrol_t diff --git a/test/moduletest/runtest/tests/memorycontrol_t b/test/moduletest/runtest/tests/memorycontrol_t new file mode 100644 index 0000000000000000000000000000000000000000..a810a9b8e7265aef01c91ce8be5567c18d1aaae9 --- /dev/null +++ b/test/moduletest/runtest/tests/memorycontrol_t @@ -0,0 +1,26 @@ +################################################################################ +# +# Copyright (C) 2022 Huawei Device Co., Ltd. +# SPDX-License-Identifier: GPL-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. +# +################################################################################ +# File: memorycontrol_t +# +# Description: memorycontrol_t testcase list +# +# Authors: Wu Lisai - wulisai@huawei-partners.com +# +# History: Nov 18 2022 - init scripts +# +################################################################################ + +memory_control01 memory_control01.sh +memory_control02 memory_control02.sh +memory_control03 memory_control03.sh +