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