From a425d10e6abb4f85d70c1ceb2a27703f6b093bcf Mon Sep 17 00:00:00 2001 From: wulisai Date: Thu, 27 Oct 2022 15:26:20 +0800 Subject: [PATCH] kernel_linux_build: add rss_threshold testcase Signed-off-by: Ke Liu --- .../testcases/bin/rss_monitor01.sh | 60 +++++++++++++++++++ .../testcases/bin/rss_monitor02.sh | 55 +++++++++++++++++ .../testcases/bin/rss_monitor03.sh | 55 +++++++++++++++++ test/moduletest/runtest/conf/OH_RK3568_config | 1 + test/moduletest/runtest/tests/rss_monitor_t | 26 ++++++++ 5 files changed, 197 insertions(+) create mode 100644 test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor01.sh create mode 100644 test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor02.sh create mode 100644 test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor03.sh create mode 100644 test/moduletest/runtest/tests/rss_monitor_t diff --git a/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor01.sh b/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor01.sh new file mode 100644 index 0000000..a26b11b --- /dev/null +++ b/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor01.sh @@ -0,0 +1,60 @@ +#!/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: rss_monitor01.sh +# +# Description: Verify /proc/pid/rss take effect +# +# Authors: Liu Ke - liuke94@huawei.com +# +# History: Sep 20 2022 - init scripts +# +################################################################################ +source tst_oh.sh + +do_setup() +{ + zcat /proc/config.gz | grep CONFIG_RSS_THRESHOLD=y || tst_res TCONF "CONFIG_RSS_THRESHOLD=y not satisfied!" +} + +do_test() +{ + local ret=0 + + tst_res TINFO "Start to verify rss ." + flag=0 + while (($flag < 1)) + do + pid=$(ps -ef | grep com.ohos.systemui | awk 'NR==1 {print $2}') + rss=$(cat /proc/$pid/rss | awk -F ':' '{print$2}'| awk '{print$1}') + statusVMRss=$(cat /proc/$pid/status | grep VmRSS | awk -F ':' '{print$2}' | awk '{print$1}') + if [ "$rss"x = "$statusVMRss"x ]; then + tst_res TPASS "rss info correct." + flag=1 + else + flag=0 + fi + done + + +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit diff --git a/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor02.sh b/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor02.sh new file mode 100644 index 0000000..1112dd2 --- /dev/null +++ b/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor02.sh @@ -0,0 +1,55 @@ +#!/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: rss_monitor02.sh +# +# Description: Verify /proc/pid/rss_threshold default value +# +# Authors: Liu Ke - liuke94@huawei.com +# +# History: Oct 27 2022 - init scripts +# +################################################################################ +source tst_oh.sh + +do_setup() +{ + zcat /proc/config.gz | grep CONFIG_RSS_THRESHOLD=y || tst_res TCONF "CONFIG_RSS_THRESHOLD=y not satisfied!" +} + +do_test() +{ + local ret=0 + tst_res TINFO "Start to verify rss_threshold default value ." + pid=$(ps -ef | grep com.ohos.systemui | awk 'NR==1 {print $2}') + value=$(cat /proc/$pid/rss_threshold | awk -F ':' '{print$2}'| awk '{print$1}') + echo $value + if [ "$value"x = "0"x ]; then + tst_res TPASS "rss_threshold default value correct." + else + tst_res TFAIL "rss_threshold default value incorrect." + ((ret++)) + fi + + +} + +do_clean() +{ + +} + +do_setup +do_test +do_clean +tst_exit diff --git a/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor03.sh b/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor03.sh new file mode 100644 index 0000000..b11a85b --- /dev/null +++ b/test/moduletest/runtest/bin/rss_monitor_t/testcases/bin/rss_monitor03.sh @@ -0,0 +1,55 @@ +#!/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: rss_monitor03.sh +# +# Description: Verify /proc/pid/rss_threshold value +# +# Authors: Wulisai - wulisai@h-partners.com +# +# History: Oct 24 2022 - init scripts +# +################################################################################ +source tst_oh.sh + +do_setup() +{ + zcat /proc/config.gz | grep CONFIG_RSS_THRESHOLD=y || tst_res TCONF "CONFIG_RSS_THRESHOLD=y not satisfied!" +} + +do_test() +{ + + local ret = 0 + pid=$(ps -ef | grep com.ohos.systemui | awk 'NR==1 {print $2}') + echo 2000 > /proc/$pid/rss_threshold + value=$(cat /proc/$pid/rss_threshold | awk -F ':' '{print$2}'| awk '{print$1}') + if [ "$value"x = "2000"x ]; then + tst_res TPASS "rss_threshold value correct." + else + tst_res TFAIL "rss_threshold value incorrect." + ((ret++)) + 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 66603f4..e01c964 100644 --- a/test/moduletest/runtest/conf/OH_RK3568_config +++ b/test/moduletest/runtest/conf/OH_RK3568_config @@ -29,3 +29,4 @@ enhancedswap_t sched_rtg_t enhancedf2fs_t mem_debug_t +rss_monitor_t diff --git a/test/moduletest/runtest/tests/rss_monitor_t b/test/moduletest/runtest/tests/rss_monitor_t new file mode 100644 index 0000000..7b657ad --- /dev/null +++ b/test/moduletest/runtest/tests/rss_monitor_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: rss_monitor_t +# +# Description: rss_monitor_t testcase list +# +# Authors: Liu Ke - liuke94@huawei.com +# +# History: Sep 20 2022 - init scripts +# +################################################################################ + +rss_monitor01 rss_monitor01.sh +rss_monitor02 rss_monitor02.sh +rss_monitor03 rss_monitor03.sh + -- Gitee