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