1f08c3bdfSopenharmony_ci#!/bin/bash 2f08c3bdfSopenharmony_ci#usage ./test_controllers.sh 3f08c3bdfSopenharmony_ci################################################################################## 4f08c3bdfSopenharmony_ci# Copyright (c) International Business Machines Corp., 2007 # 5f08c3bdfSopenharmony_ci# # 6f08c3bdfSopenharmony_ci# This program is free software; you can redistribute it and/or modify # 7f08c3bdfSopenharmony_ci# it under the terms of the GNU General Public License as published by # 8f08c3bdfSopenharmony_ci# the Free Software Foundation; either version 2 of the License, or # 9f08c3bdfSopenharmony_ci# (at your option) any later version. # 10f08c3bdfSopenharmony_ci# # 11f08c3bdfSopenharmony_ci# This program is distributed in the hope that it will be useful, # 12f08c3bdfSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of # 13f08c3bdfSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See # 14f08c3bdfSopenharmony_ci# the GNU General Public License for more details. # 15f08c3bdfSopenharmony_ci# # 16f08c3bdfSopenharmony_ci# You should have received a copy of the GNU General Public License # 17f08c3bdfSopenharmony_ci# along with this program; if not, write to the Free Software # 18f08c3bdfSopenharmony_ci# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # 19f08c3bdfSopenharmony_ci# # 20f08c3bdfSopenharmony_ci################################################################################## 21f08c3bdfSopenharmony_ci# Name Of File: test_controllers.sh # 22f08c3bdfSopenharmony_ci# # 23f08c3bdfSopenharmony_ci# Description: # 24f08c3bdfSopenharmony_ci# This file runs the tests for resource management ie to test cpu # 25f08c3bdfSopenharmony_ci# controller and memory controller. (for now cpu controller only) # 26f08c3bdfSopenharmony_ci# # 27f08c3bdfSopenharmony_ci# Author: Sudhir Kumar <sudhirkumarmalik@In.ibm.com> # 28f08c3bdfSopenharmony_ci# # 29f08c3bdfSopenharmony_ci# History: # 30f08c3bdfSopenharmony_ci# # 31f08c3bdfSopenharmony_ci# DATE NAME EMAIL DESC # 32f08c3bdfSopenharmony_ci# # 33f08c3bdfSopenharmony_ci# 20/12/07 Sudhir Kumar <sudhirkumarmalik@in.ibm.com> Created this test # 34f08c3bdfSopenharmony_ci# 02/03/09 Miao Xie <miaox@cn.fujitsu.com> Add cpuset testset # 35f08c3bdfSopenharmony_ci# 07/07/09 Shi Weihua <shiwh@cn.fujitsu.com> Add cpu testset of Fujitsu # 36f08c3bdfSopenharmony_ci# 30/12/09 Rishikesh <risrajak@linux.vnet.ibm.com> Added enable/disable # 37f08c3bdfSopenharmony_ci# # 38f08c3bdfSopenharmony_ci################################################################################## 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ciif [ -f /proc/cgroups ] 41f08c3bdfSopenharmony_cithen 42f08c3bdfSopenharmony_ci CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`; 43f08c3bdfSopenharmony_ci CPU_CONTROLLER_VALUE=`grep -w cpu /proc/cgroups | cut -f4`; 44f08c3bdfSopenharmony_ci MEM_CONTROLLER=`grep -w memory /proc/cgroups | cut -f1`; 45f08c3bdfSopenharmony_ci MEM_CONTROLLER_VALUE=`grep -w memory /proc/cgroups | cut -f4`; 46f08c3bdfSopenharmony_ci IOTHROTTLE_CONTROLLER=`grep -w blockio /proc/cgroups | cut -f1`; 47f08c3bdfSopenharmony_ci IOTHROTTLE_CONTROLLER_VALUE=`grep -w blockio /proc/cgroups | cut -f4`; 48f08c3bdfSopenharmony_ci FREEZER=`grep -w freezer /proc/cgroups | cut -f1`; 49f08c3bdfSopenharmony_ci FREEZER_VALUE=`grep -w freezer /proc/cgroups | cut -f4`; 50f08c3bdfSopenharmony_ci CPUACCOUNT_CONTROLLER=`grep -w cpuacct /proc/cgroups | cut -f1` 51f08c3bdfSopenharmony_ci CPUACCOUNT_CONTROLLER_VALUE=`grep -w cpuacct /proc/cgroups | cut -f4` 52f08c3bdfSopenharmony_ci 53f08c3bdfSopenharmony_ci if [ "$CPU_CONTROLLER" = "cpu" ] && [ "$CPU_CONTROLLER_VALUE" = "1" ] 54f08c3bdfSopenharmony_ci then 55f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_test.sh 1; 56f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_test.sh 3; 57f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_test.sh 4; 58f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_test.sh 5; 59f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 6; 60f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 7; 61f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 8; 62f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 9; 63f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 10; 64f08c3bdfSopenharmony_ci # Add the latency testcase to be run 65f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_latency_test.sh 1; 66f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_latency_test.sh 2; 67f08c3bdfSopenharmony_ci # Add the testcases from Fujitsu 68f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuctl_test_fj.sh 69f08c3bdfSopenharmony_ci else 70f08c3bdfSopenharmony_ci echo "CONTROLLERS TESTCASES: WARNING"; 71f08c3bdfSopenharmony_ci echo "Either Kernel does not support for cpu controller or functionality is not enabled"; 72f08c3bdfSopenharmony_ci echo "Skipping all cpu controller testcases...."; 73f08c3bdfSopenharmony_ci fi; 74f08c3bdfSopenharmony_ci 75f08c3bdfSopenharmony_ci if [ "$MEM_CONTROLLER" = "memory" ] && [ "$MEM_CONTROLLER_VALUE" = "1" ] 76f08c3bdfSopenharmony_ci then 77f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_memctl_test.sh 1; 78f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_memctl_test.sh 2; 79f08c3bdfSopenharmony_ci else 80f08c3bdfSopenharmony_ci echo "CONTROLLERS TESTCASES: WARNING"; 81f08c3bdfSopenharmony_ci echo "Either Kernel does not support for memory controller or functionality is not enabled"; 82f08c3bdfSopenharmony_ci echo "Skipping all memory controller testcases...."; 83f08c3bdfSopenharmony_ci fi 84f08c3bdfSopenharmony_ci 85f08c3bdfSopenharmony_ci if [ "$IOTHROTTLE_CONTROLLER" = "blockio" ] && [ "$IOTHROTTLE_CONTROLLER_VALUE" = "1" ] 86f08c3bdfSopenharmony_ci then 87f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_io_throttle_test.sh; 88f08c3bdfSopenharmony_ci else 89f08c3bdfSopenharmony_ci echo "CONTROLLERS TESTCASES: WARNING"; 90f08c3bdfSopenharmony_ci echo "Either Kernel does not support for io controller or functionality is not enabled"; 91f08c3bdfSopenharmony_ci echo "Skipping all block device I/O throttling testcases...."; 92f08c3bdfSopenharmony_ci fi 93f08c3bdfSopenharmony_ci 94f08c3bdfSopenharmony_ci if [ "$FREEZER" = "freezer" ] && [ "$FREEZER_VALUE" = "1" ] 95f08c3bdfSopenharmony_ci then 96f08c3bdfSopenharmony_ci "$LTPROOT/testcases/bin/run_freezer.sh" 97f08c3bdfSopenharmony_ci else 98f08c3bdfSopenharmony_ci echo "CONTROLLERS TESTCASES: WARNING"; 99f08c3bdfSopenharmony_ci echo "Either Kernel does not support for freezer or functionality is not enabled"; 100f08c3bdfSopenharmony_ci echo "Kernel does not support freezer controller"; 101f08c3bdfSopenharmony_ci echo "Skipping all freezer testcases...."; 102f08c3bdfSopenharmony_ci fi 103f08c3bdfSopenharmony_ci if [ "$CPUACCOUNT_CONTROLLER" = "cpuacct" ] && [ "$CPUACCOUNT_CONTROLLER_VALUE" = "1" ] 104f08c3bdfSopenharmony_ci then 105f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuacct_test.sh 1; 106f08c3bdfSopenharmony_ci $LTPROOT/testcases/bin/run_cpuacct_test.sh 2; 107f08c3bdfSopenharmony_ci else 108f08c3bdfSopenharmony_ci echo "Could not start cpu accounting controller test"; 109f08c3bdfSopenharmony_ci echo "Either Kernel does not support for cpu accounting controller or functionality is not enabled"; 110f08c3bdfSopenharmony_ci echo "usage: run_cpuacct_test.sh $TEST_NUM "; 111f08c3bdfSopenharmony_ci echo "Skipping the cpu accounting controller test..."; 112f08c3bdfSopenharmony_ci fi 113f08c3bdfSopenharmony_cielse 114f08c3bdfSopenharmony_ci echo "CONTROLLERS TESTCASES: WARNING" 115f08c3bdfSopenharmony_ci echo "Kernel does not support any controller"; 116f08c3bdfSopenharmony_ci echo "Skipping all controllers testcases...."; 117f08c3bdfSopenharmony_cifi 118f08c3bdfSopenharmony_ci 119f08c3bdfSopenharmony_ciexit 0; 120