From patchwork Tue Mar 5 14:12:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elif Aslan X-Patchwork-Id: 1051744 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44DJkh3gt5z9s47 for ; Wed, 6 Mar 2019 01:12:44 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 9E7233EA0EB for ; Tue, 5 Mar 2019 15:12:41 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id 3DB6D3EA0B7 for ; Tue, 5 Mar 2019 15:12:40 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id A880F6002E8 for ; Tue, 5 Mar 2019 15:12:38 +0100 (CET) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x25EBWYO136807 for ; Tue, 5 Mar 2019 09:12:36 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2r1snvbbtg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Mar 2019 09:12:36 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Mar 2019 14:12:33 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 5 Mar 2019 14:12:30 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x25ECU3630015502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Mar 2019 14:12:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC401AE045; Tue, 5 Mar 2019 14:12:29 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 971D4AE053; Tue, 5 Mar 2019 14:12:29 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.187.112]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Mar 2019 14:12:29 +0000 (GMT) From: Elif Aslan To: ltp@lists.linux.it Date: Tue, 5 Mar 2019 15:12:25 +0100 X-Mailer: git-send-email 2.17.2 (Apple Git-113) X-TM-AS-GCONF: 00 x-cbid: 19030514-4275-0000-0000-0000031727AF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19030514-4276-0000-0000-000038257AFE Message-Id: <20190305141225.4422-1-elas@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-05_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903050095 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=1.0 required=7.0 tests=KHOP_DYNAMIC autolearn=disabled version=3.4.0 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Subject: [LTP] [PATCH] contributing cpuplugd and mon_fsstatd tests X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" --- runtest/s390x_tests | 3 + testcases/commands/cpuplugd/README.md | 35 ++ testcases/commands/cpuplugd/cmm.conf | 10 + testcases/commands/cpuplugd/cpu.conf | 8 + testcases/commands/cpuplugd/cpuplugd.conf | 15 + testcases/commands/cpuplugd/cpuplugd.sh | 477 ++++++++++++++++++ testcases/commands/cpuplugd/cpuplugdcmm.conf | 10 + testcases/commands/cpuplugd/cpuplugdtemp.conf | 15 + testcases/commands/cpuplugd/mon_fsstatd.sh | 164 ++++++ 9 files changed, 737 insertions(+) create mode 100644 runtest/s390x_tests create mode 100644 testcases/commands/cpuplugd/README.md create mode 100644 testcases/commands/cpuplugd/cmm.conf create mode 100644 testcases/commands/cpuplugd/cpu.conf create mode 100644 testcases/commands/cpuplugd/cpuplugd.conf create mode 100644 testcases/commands/cpuplugd/cpuplugd.sh create mode 100644 testcases/commands/cpuplugd/cpuplugdcmm.conf create mode 100644 testcases/commands/cpuplugd/cpuplugdtemp.conf create mode 100644 testcases/commands/cpuplugd/mon_fsstatd.sh diff --git a/runtest/s390x_tests b/runtest/s390x_tests new file mode 100644 index 000000000..b05b2f58b --- /dev/null +++ b/runtest/s390x_tests @@ -0,0 +1,3 @@ +# Those tests are designed to be executed in s390x environment (zVM or LPAR) +cpuplugd cpuplugd.sh +mon_fsstatd mon_fsstatd.sh diff --git a/testcases/commands/cpuplugd/README.md b/testcases/commands/cpuplugd/README.md new file mode 100644 index 000000000..6cf33f212 --- /dev/null +++ b/testcases/commands/cpuplugd/README.md @@ -0,0 +1,35 @@ +# cpuplugd mon_fsstatd tools test + +cpuplugd: Daemon that manages CPU and memory resources based on a set of rules. +Depending on the workload CPUs can be enabled or disabled. +The amount of memory can be increased or decreased exploiting the Cooperative Memory Management (CMM1) feature. + +## Getting started + +The test case contains the following scripts: + +- **cmm.conf** _configuration file_ +- **cpu.conf** _configuration file_ +- **cpuplugd.conf** _configuration file_ +- **cpuplugd.sh** _verification of cpuplugd tool_ +- **cpuplugdcmm.conf** _configuration file_ +- **cpuplugdtemp.conf** _configuration file_ +- **mon_fsstatd.sh** _mon tool tests_ + +## Prerequisites + +z/VM guest or LPAR must be prepared to be populated with guest OS + +## Installation + +Scripts are to be copied into the target test system + +## Running the tests + +runtest/s390x_tests contains all the necessary commands to be executed: +`./cpuplugd.sh` +`./mon_fsstatd.sh` + +## License + +The files in this directory are licensed under the GPL v2+ license. diff --git a/testcases/commands/cpuplugd/cmm.conf b/testcases/commands/cpuplugd/cmm.conf new file mode 100644 index 000000000..59e71f726 --- /dev/null +++ b/testcases/commands/cpuplugd/cmm.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +UPDATE="1" + +CMM_MIN="5000" +CMM_INC="100" +CMM_MAX="20000" + +MEMPLUG="swaprate < 200" +MEMUNPLUG="swaprate > 5000" diff --git a/testcases/commands/cpuplugd/cpu.conf b/testcases/commands/cpuplugd/cpu.conf new file mode 100644 index 000000000..6a84d8177 --- /dev/null +++ b/testcases/commands/cpuplugd/cpu.conf @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +CPU_MIN="1" +CPU_MAX="3" +UPDATE="1" + +HOTPLUG="(loadavg > onumcpus + 0.75) & (idle < 10.0)" +HOTUNPLUG="(loadavg < onumcpus - 0.25) | (idle > 50)" diff --git a/testcases/commands/cpuplugd/cpuplugd.conf b/testcases/commands/cpuplugd/cpuplugd.conf new file mode 100644 index 000000000..09d76b993 --- /dev/null +++ b/testcases/commands/cpuplugd/cpuplugd.conf @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +CPU_MIN="1" +CPU_MAX="3" +UPDATE="1" + +HOTPLUG="(loadavg > onumcpus + 0.75) & (idle < 10.0)" +HOTUNPLUG="(loadavg < onumcpus - 0.25) | (idle > 50)" + +CMM_MIN="0" +CMM_INC="10" +CMM_MAX="10" + +MEMPLUG="swaprate < 200" +MEMUNPLUG="swaprate > 5000" diff --git a/testcases/commands/cpuplugd/cpuplugd.sh b/testcases/commands/cpuplugd/cpuplugd.sh new file mode 100644 index 000000000..2a3b2964f --- /dev/null +++ b/testcases/commands/cpuplugd/cpuplugd.sh @@ -0,0 +1,477 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +#!/bin/sh + +TST_CNT=11 +TST_TESTFUNC=cpuplugd_test +. tst_test.sh + +number_of_cpus=$(grep -c ^processor /proc/cpuinfo) +SLEEP_X=$((number_of_cpus*2)) +CMM_MOD="$(grep "CONFIG_CMM=" /boot/config-$(uname -r) | cut -d= -f2 | tr '[:upper:]' '[:lower:]')" + + +load_vmcp(){ + local GUESTNAME="" + + if [ ! -e /proc/sysinfo ] ; then + echo "Cannot access /proc/sysinfo" >&1 + exit 1 + fi + + GUESTNAME="$(cat /proc/sysinfo | grep -i VM00.Name | sed 's/^.*:[[:space:]]*//g;s/[[:space:]]//g' | tr '[a-z]' '[A-Z]')" + + if [ -n "$GUESTNAME" ];then + `vmcp q cpus > /dev/null 2>&1` + if [ $? -ne 0 ];then + modprobe vmcp >/dev/null 2>&1 + echo "Module vmcp loaded" + fi + return 0 + fi + return 1 +} + +isVM(){ + local GUESTNAME="" + local GUESTNO="" + + if [ ! -e /proc/sysinfo ] ; then + echo "Cannot access /proc/sysinfo" >&1 + exit 1 + fi + + GUESTNAME="$(cat /proc/sysinfo | grep -i VM00.Name | sed 's/^.*:[[:space:]]*//g;s/[[:space:]]//g' | tr '[a-z]' '[A-Z]')" + + if [ -z "$GUESTNAME" ];then + return 1 + fi + if [ -n "$GUESTNAME" ];then + load_vmcp + return 0 + fi + return 1 +} + +assert_cpuplugd_running() { + local NOT_RUNNING="$1" + local WARN="$2" + + if [ "$NOT_RUNNING" -eq "0" ]; then + MESSAGE="cpuplugd is running" + elif [ "$NOT_RUNNING" -eq "1" ]; then + MESSAGE="cpuplugd is not running" + fi + + ps -e | grep -q cpuplugd + local RC=$? + + if [ "$WARN" -eq "1" ]; then + if [ "$RC" -eq "$NOT_RUNNING" ]; then + tst_res TPASS "$MESSAGE" + else + tst_res TFAIL "$MESSAGE" + fi + fi + + return $RC +} + +stop_cpuplugd() { + echo "stop cpuplugd" + + if [ -e /run/cpuplugd.pid ]; then + kill $(cat /run/cpuplugd.pid) + elif [ -e /var/run/cpuplugd.pid ]; then + kill $(cat /var/run/cpuplugd.pid) + else + kill $(ps -e | grep -i cpuplugd | awk '{print $1}') + fi + + until ! assert_cpuplugd_running 1 0; do + echo "cpuplugd is still running" + sleep 1 + done + + echo "check cpuplugd is not running" + if [ $? -eq 0 ]; then + tst_res TPASS "Test passed" + else + tst_res TFAIL "Test failed" + fi + +} + +#Function to remove the given entry ($1) from test configuration file +prepare_incomplete_cpu_test_config() { + rm -rf cpuplugdtest.conf + cp cpuplugd.conf cpuplugdtest.conf + sed -e 's/'$1'/#'$1'/' -i cpuplugdtest.conf +} + +prepare_incomplete_cmm_test_config() { + rm -rf cpuplugdtest.conf + cp cpuplugdcmm.conf cpuplugdtest.conf + sed -e 's/'$1'/#'$1'/' -i cpuplugdtest.conf +} + +#run cpuplgd with cpuplugdtest.conf and verify change in number of cpus before/during/after running the daemon +cpu_test_with_error_in_cpuplgdtest_conf() { + local NOT_RUNNING="$1" + local WARN="$2" + + # cmm must not be loaded so that cpuplugd will only consider the cpu configuration + if [ "$CMM_MOD" = "m" ]; then + rmmod cmm + fi + + assert_cpuplugd_running 1 0 + local RC=$? + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + cpusbefore=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + echo "start cpuplugd -V -c cpuplugdtest.conf -f" + cpuplugd -V -c cpuplugdtest.conf -f >> cpuf & + sleep 2 + + if [ "$CMM_MOD" = "m" ]; then + assert_cpuplugd_running $NOT_RUNNING $WARN + else + assert_cpuplugd_running $NOT_RUNNING $WARN + fi + + local RC=$? + + # Wait a little to allow for (undesired) cpu configuration change + sleep $SLEEP_X + cpusrunning=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + local cpusafter=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + local i=0 + + if (( "$cpusbefore" == "$cpusrunning" )) && (( "$cpusrunning" == "$cpusafter" )); then + i=1 + fi + + echo "Verify that CPU configuration does not change: cpusbefore=$cpusbefore, cpusduring=$cpusrunning, cpusafterter=$cpusafter" + if [ $i -eq 1 ]; then + tst_res TPASS "Test passed" + else + tst_res TFAIL "Test failed" + fi +} + +#run cpuplgd with cpuplugdtest.conf and verify change in number of cmm pagess before/during/after running the daemon +cmm_test_with_error_in_cpuplgdtest_conf() { + local NOT_RUNNING="$1" + local WARN="$2" + + assert_cpuplugd_running 1 0 + local RC=$? + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + if [ "$CMM_MOD" = "m" ]; then + modprobe cmm + fi + + echo 1000 > /proc/sys/vm/cmm_pages + sleep 2 + + cmm_pages_before=$(cat /proc/sys/vm/cmm_pages) + + echo "start cpuplugd -V -c cpuplugdtest.conf -f" + cpuplugd -V -c cpuplugdtest.conf -f >> cmm & + sleep 2 + + assert_cpuplugd_running $NOT_RUNNING $WARN + local RC=$? + + # Wait a little to allow for (undesired) cpu configuration change + sleep $SLEEP_X + local cmm_pages_running=$(cat /proc/sys/vm/cmm_pages) + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + local cmm_pages_after=$(cat /proc/sys/vm/cmm_pages) + i=0 + + if (( "$cmm_pages_before" == "$cmm_pages_running" )) && (( "$cmm_pages_running" == "$cmm_pages_after" )); then + i=1 + fi + + echo "Verify that the number of available CMM pages does not change: cmm_pages_before=$cmm_pages_before, cmm_pages_running=$cmm_pages_running, cmm_pages_after=$cmm_pages_after" + if [ "${i}" -eq "1" ]; then + tst_res TPASS "Test passed" + else + tst_res TFAIL "Test failed" + fi + + if [ "$CMM_MOD" = "m" ]; then + rmmod cmm + fi +} + +exec_cpu_test_with_error_in_cpuplugd_conf() +{ + local notrun=1 + isVM && [ "$CMM_MOD" = "y" ] && notrun=0 + cpu_test_with_error_in_cpuplgdtest_conf $notrun 1 +} + +cpuplugd_run() +{ + + $1 + if [ "$?" -eq "$2" ]; then + tst_res TPASS "'$1' returned '$2'" + else + tst_res TFAIL "'$1' did not return '$2'" + fi +} + +cpuplugd_test1() +{ + tst_res TINFO "Cpuplugd version" + local cpuplugd=$(cpuplugd -v | head -n 1 | cut -d":" -f2 | cut -d" " -f10) + cpuplugd_run "cpuplugd -v" 0 + echo "Cpuplugd version $cpuplugd" +} +cpuplugd_test2() +{ + tst_res TINFO "Cpuplugd Help information checking" + echo "Checking for Help information with -h option" + cpuplugd_run "cpuplugd -h" 0 + echo "Checking for Help information with --help option" + cpuplugd_run "cpuplugd --help" 0 +} + +# Run several tests with incomplete/broken configuration. +# Correct behavior for the daemon is not to start. +cpuplugd_test3() +{ + tst_res TINFO "Invalid options checking" + echo "Checking for Invalid option -H" + cpuplugd_run "cpuplugd -H" 1 + echo "Checking for Invalid option -1234" + cpuplugd_run "cpuplugd -1234" 1 +} + +cpuplugd_test4() +{ + tst_res TINFO "Run daemon without UPDATE entry in config" + prepare_incomplete_cpu_test_config UPDATE + cpu_test_with_error_in_cpuplgdtest_conf 1 1 +} + +cpuplugd_test5() +{ + tst_res TINFO "Run Daemon without CPU_MIN entry" + prepare_incomplete_cpu_test_config CPU_MIN + exec_cpu_test_with_error_in_cpuplugd_conf +} + +cpuplugd_test6() +{ + tst_res TINFO "Run Daemon without CPU_MAX entry" + prepare_incomplete_cpu_test_config CPU_MAX + cpu_test_with_error_in_cpuplgdtest_conf 1 1 +} + +cpuplugd_test7() +{ + tst_res TINFO "Run Daemon without HOTPLUG entry" + prepare_incomplete_cpu_test_config HOTPLUG + exec_cpu_test_with_error_in_cpuplugd_conf +} + +cpuplugd_test8() +{ + tst_res TINFO "Run Daemon without HOTUNPLUG entry" + prepare_incomplete_cpu_test_config HOTUNPLUG + exec_cpu_test_with_error_in_cpuplugd_conf +} + +# Good path test for CPU plugging. +# Run daemon with only cpu configuration in configuration file +# CPU Hotplug with 3 Active cpus and CPU_MIN=1 and CPU_MAX=3 +# Verify that number of CPUs is reduced after daemon is started +# and restored after daemon is stopped. +cpuplugd_test9() +{ + tst_res TINFO "Run Daemon with only cpu configuration" + + assert_cpuplugd_running 1 1 + + local cpusbefore=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + echo "running daemon with only cpu config" > cpuf + echo "start cpuplugd -V -c cpu.conf -f " + cpuplugd -V -c cpu.conf -f >> cpuf & + sleep 2 + + assert_cpuplugd_running 0 1 + local RC=$? + echo "Let Daemon run for few seconds, so that it does the hotplugging" + sleep $SLEEP_X + + local cpusrunning=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + sleep 2 + local cpusafter=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + i=0 + + if [ "$cpusbefore" != "$cpusrunning" ] && [ "$cpusbefore" == "$cpusafter" ]; then + tst_res TPASS "Verify that number of CPUs before, while and after the daemon runs changes: cpusbefore=$cpusbefore, cpusduring=$cpusrunning, cpusafterter=$cpusafter" + else + tst_res TFAIL "Verify that number of CPUs before, while and after the daemon runs changes: cpusbefore=$cpusbefore, cpusduring=$cpusrunning, cpusafterter=$cpusafter" + fi +} + +cpuplugd_test10() +{ + tst_res TINFO "Memory Hotplug tests (z/VM only)" + + if ! isVM; then + # if it is LPAR, Memory Hotplug cannot be done + tst_res TINFO "This must be an LPAR. Skip CMM Tests" + return; + fi + + # Run several tests with incomplete/broken configuration. + # Correct behavior for the daemon is not to start. + + tst_res TINFO "Run Daemon without loading CMM module" + if [ "$CMM_MOD" != "m" ]; then + tst_res TINFO "This test is not possible to be performed since CMM was builtin within the kernel and cannot be unloaded." + else + assert_cpuplugd_running 1 0 + local RC=$? + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + rmmod cmm + lsmod | grep -q cmm + + if [ "$?" -eq "1" ]; then + tst_res TPASS "Verify that CMM module is not loaded" + else + tst_res TFAIL "Verify that CMM module is not loaded" + fi + + cpuplugd -V -c cmm.conf -f >> cmm.log & + echo "Daemon should fail to run as CMM module is not loaded" + sleep 2 + + assert_cpuplugd_running 1 1 + local RC=$? + + rm -rf cmm.log + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + fi + + + tst_res TINFO "Run Daemon without CMM_MIN entry" + prepare_incomplete_cmm_test_config CMM_MIN + cmm_test_with_error_in_cpuplgdtest_conf 1 1 + + + tst_res TINFO "Run Daemon without CMM_MAX entry" + prepare_incomplete_cmm_test_config CMM_MAX + cmm_test_with_error_in_cpuplgdtest_conf 1 1 + + + tst_res TINFO "Run Daemon without CMM_INC entry" + prepare_incomplete_cmm_test_config CMM_INC + cmm_test_with_error_in_cpuplgdtest_conf 1 1 + + + tst_res TINFO "Run Daemon without MEMPLUG entry" + prepare_incomplete_cmm_test_config MEMPLUG + cmm_test_with_error_in_cpuplgdtest_conf 1 1 + + + tst_res TINFO "Run Daemon without MEMUNPLUG entry" + prepare_incomplete_cmm_test_config MEMUNPLUG + cmm_test_with_error_in_cpuplgdtest_conf 1 1 + + + # Good path test for CMM plugging + + tst_res TINFO "Run Daemon with only CMM configuration" + if [ "$CMM_MOD" = "m" ]; then + modprobe cmm + fi + + echo 1000 > /proc/sys/vm/cmm_pages + sleep 1 + + local cmm_pages_before=$(cat /proc/sys/vm/cmm_pages) + local cpusbefore=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + cpuplugd -V -c cmm.conf -f >> cmm.log & + sleep 2 + + assert_cpuplugd_running 0 1 + local RC=$? + sleep 4 + + local cmm_pages_running=$(cat /proc/sys/vm/cmm_pages) + local cpusrunning=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + + if [ "$RC" -eq "0" ]; then + stop_cpuplugd + fi + + sleep 2 + + local cmm_pages_after=$(cat /proc/sys/vm/cmm_pages) + local cpusafter=$(grep "processors" /proc/cpuinfo | cut -d":" -f2) + local i=0 + + if [ "$cmm_pages_before" != "$cmm_pages_running" ] && [ "$cmm_pages_before" == "$cmm_pages_after" ]; then + if [ "$cpusbefore" == "$cpusrunning" ] && [ "$cpusbefore" == "$cpusafter" ]; then + i=1 + fi + fi + + if [ "$i" -eq "1" ];then + tst_res TPASS "Verify that the number of cmm_pages before, while and after the daemon runs changes: cmm_pages_before=$cmm_pages_before, cmm_pages_running=$cmm_pages_running, cmm_pages_after=$cmm_pages_after. CPU hotplugging should not happen and cpu configuration should remain constant: cpus_before=$cpusbefore, cpus_during=$cpusrunning, cpus_after=$cpusafter" + else + tst_res TFAIL "Verify that the number of cmm_pages before, while and after the daemon runs changes: cmm_pages_before=$cmm_pages_before, cmm_pages_running=$cmm_pages_running, cmm_pages_after=$cmm_pages_after. CPU hotplugging should not happen and cpu configuration should remain constant: cpus_before=$cpusbefore, cpus_during=$cpusrunning, cpus_after=$cpusafter" + fi + +} + +cpuplugd_test11() +{ + tst_res TINFO "Doing the cleanup tasks ..." + cpuplugd_run "service cpuplugd stop" 0 + + if [ "$CMM_MOD" = "m" ]; then + cpuplugd_run "rmmod cmm" 0 + fi + + cpuplugd_run "rm -rf cpuf cmm log cmm.log cpuplugdtest.conf te.tes out.txt.tmp" 0 + +} + +tst_run diff --git a/testcases/commands/cpuplugd/cpuplugdcmm.conf b/testcases/commands/cpuplugd/cpuplugdcmm.conf new file mode 100644 index 000000000..ca393249e --- /dev/null +++ b/testcases/commands/cpuplugd/cpuplugdcmm.conf @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +UPDATE="1" + +CMM_MIN="0" +CMM_INC="10" +CMM_MAX="10" + +MEMPLUG="swaprate < 200" +MEMUNPLUG="swaprate > 5000" diff --git a/testcases/commands/cpuplugd/cpuplugdtemp.conf b/testcases/commands/cpuplugd/cpuplugdtemp.conf new file mode 100644 index 000000000..157422780 --- /dev/null +++ b/testcases/commands/cpuplugd/cpuplugdtemp.conf @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +CPU_MIN="1" +CPU_MAX="3" +UPDATE="1" + +HOTPLUG="(loadavg > onumcpus + 0.75) & (idle < 10.0)" +HOTUNPLUG="(loadavg < onumcpus - 0.25) | (idle > 50)" + +#CMM_MIN="0" +CMM_INC="10" +CMM_MAX="10" + +MEMPLUG="swaprate < 200" +MEMUNPLUG="swaprate > 5000" diff --git a/testcases/commands/cpuplugd/mon_fsstatd.sh b/testcases/commands/cpuplugd/mon_fsstatd.sh new file mode 100644 index 000000000..fdbd3ee3d --- /dev/null +++ b/testcases/commands/cpuplugd/mon_fsstatd.sh @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +#!/bin/sh + +sed -i 's/FSSTAT="no"/FSSTAT="yes"/' /etc/sysconfig/mon_statd +sed -i 's/PROC="no"/PROC="yes"/' /etc/sysconfig/mon_statd + +TST_CNT=1 +TST_TESTFUNC=mon_fsstatd_test +. tst_test.sh + +load_vmcp(){ + local GUESTNAME="" + + if [ ! -e /proc/sysinfo ] ; then + echo "Cannot access /proc/sysinfo" >&1 + exit 1 + fi + + GUESTNAME="$(cat /proc/sysinfo | grep -i VM00.Name | sed 's/^.*:[[:space:]]*//g;s/[[:space:]]//g' | tr '[a-z]' '[A-Z]')" + + if [ -n "$GUESTNAME" ];then + `vmcp q cpus > /dev/null 2>&1` + if [ $? -ne 0 ];then + modprobe vmcp >/dev/null 2>&1 + echo "Module vmcp loaded" + fi + return 0 + fi + return 1 +} + +s390_config_check(){ + local config="$1" + local config_line=$(env | grep "$config=") + + if [ $? -ne 0 ]; then + tst_res TFAIL "Config option $config not defined" + exit 1 + else + local value=$(echo $config_line | awk -F = '{print $2}') + echo "USING CONFIG: $config=$value" + fi +} + +isVM(){ + local GUESTNAME="" + local GUESTNO="" + + if [ ! -e /proc/sysinfo ] ; then + echo "Cannot access /proc/sysinfo" >&1 + exit 1 + fi + + GUESTNAME="$(cat /proc/sysinfo | grep -i VM00.Name | sed 's/^.*:[[:space:]]*//g;s/[[:space:]]//g' | tr '[a-z]' '[A-Z]')" + + if [ -z "$GUESTNAME" ];then + return 1 + fi + if [ -n "$GUESTNAME" ];then + load_vmcp + return 0 + fi + return 1 +} + +s390_config_check S390_mon_statd + + +mon_fsstatd_run() +{ + $2 + if [ "$?" -eq "$1" ]; then + tst_res TPASS "'$2' returned '$1'" + else + tst_res TFAIL "'$2' did not return '$1'" + fi +} + +mon_fsstatd_test1() +{ + if ! isVM; then + tst_res TINFO "This must be an LPAR. Not applicable in LPAR" + return; + fi + + tst_res TINFO "Basic User option Verification" + mon_fsstatd_run 0 "modprobe monwriter max_bufs=8192" + + sleep 2 + service mon_statd status + [ $? -eq 3 ] && tst_res TINFO "mon_statd is not started yet" + + sleep 2 + mon_fsstatd_run 0 "service mon_statd stop" + + sleep 2 + mon_fsstatd_run 0 "service mon_statd start" + + sleep 2 + mon_fsstatd_run 0 "pidof mon_fsstatd" + mon_fsstatd_run 0 "pidof mon_procd" + + sleep 2 + mon_fsstatd_run 0 "service mon_statd restart" + + sleep 2 + mon_fsstatd_run 0 "mon_fsstatd -h" + + sleep 2 + mon_fsstatd_run 0 "mon_fsstatd --help" + + sleep 2 + mon_fsstatd_run 0 "mon_fsstatd -v" + + sleep 2 + mon_fsstatd_run 0 "mon_fsstatd --version" + + sleep 2 + mon_fsstatd_run 0 "mon_fsstatd -i 30" + + sleep 2 + mon_fsstatd_run 0 "mon_procd -h" + + sleep 2 + mon_fsstatd_run 0 "mon_procd --help" + + sleep 2 + mon_fsstatd_run 0 "mon_procd -v" + + sleep 2 + mon_fsstatd_run 0 "mon_procd --version" + + sleep 2 + mon_fsstatd_run 0 "mon_procd -i 30" + + sleep 2 + mon_procd -a & + if [ "$?" -eq "0" ]; then + tst_res TPASS "'mon_procd -a' returned 0" + else + tst_res TFAIL "'mon_procd -a' did not return 0" + fi + + sleep 2 + mon_fsstatd_run 0 "killall mon_procd" + + sleep 2 + mon_fsstatd -a & + if [ "$?" -eq "0" ]; then + tst_res TPASS "'mon_fsstatd -a' returned 0" + else + tst_res TFAIL "'mon_fsstatd -a' did not return 0" + fi + + sleep 2 + mon_fsstatd_run 0 "killall mon_fsstatd" + + sleep 2 + mon_fsstatd_run 0 "mon_procd -v" + +} + +tst_run