!170 memcg_control testcase

Merge pull request !170 from lk_huawei/master
This commit is contained in:
openharmony_ci
2022-11-23 06:41:09 +00:00
committed by Gitee
5 changed files with 182 additions and 0 deletions
@@ -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
@@ -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
@@ -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
@@ -31,3 +31,4 @@ enhancedf2fs_t
mem_debug_t
rss_monitor_t
purgeable_t
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