test_controllers.sh revision 70259d6e7ec2569972fb663ea85f959c4f2b4f81
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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#                                                                                #
36##################################################################################
37
38if [ -f /proc/cgroups ]
39then
40	CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`;
41	MEM_CONTROLLER=`grep -w memory /proc/cgroups | cut -f1`;
42	IOTHROTTLE_CONTROLLER=`grep -w blockio /proc/cgroups | cut -f1`;
43	FREEZER=`grep -w freezer /proc/cgroups | cut -f1`;
44	CPUSET_CONTROLLER=`grep -w cpuset /proc/cgroups | cut -f1`
45
46	if [ "$CPU_CONTROLLER" = "cpu" ]
47	then
48		$LTPROOT/testcases/bin/run_cpuctl_test.sh 1;
49		$LTPROOT/testcases/bin/run_cpuctl_test.sh 3;
50		$LTPROOT/testcases/bin/run_cpuctl_test.sh 4;
51		$LTPROOT/testcases/bin/run_cpuctl_test.sh 5;
52		$LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 6;
53		$LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 7;
54		$LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 8;
55		$LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 9;
56		$LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 10;
57		# Add the latency testcase to be run
58		$LTPROOT/testcases/bin/run_cpuctl_latency_test.sh 1;
59		$LTPROOT/testcases/bin/run_cpuctl_latency_test.sh 2;
60	else
61		echo "CONTROLLERS TESTCASES: WARNING";
62		echo "Kernel does not support for cpu controller";
63		echo "Skipping all cpu controller testcases....";
64	fi;
65
66	if [ "$MEM_CONTROLLER" = "memory" ]
67	then
68		$LTPROOT/testcases/bin/run_memctl_test.sh 1;
69		$LTPROOT/testcases/bin/run_memctl_test.sh 2;
70		$LTPROOT/testcases/bin/run_memctl_test.sh 3;
71		$LTPROOT/testcases/bin/run_memctl_test.sh 4;
72	else
73		echo "CONTROLLERS TESTCASES: WARNING";
74		echo "Kernel does not support for memory controller";
75		echo "Skipping all memory controller testcases....";
76	fi
77
78	if [ "$IOTHROTTLE_CONTROLLER" = "blockio" ]
79	then
80		$LTPROOT/testcases/bin/run_io_throttle_test.sh;
81	else
82		echo "CONTROLLERS TESTCASES: WARNING";
83		echo "Kernel does not support blockio controller";
84		echo "Skipping all block device I/O throttling testcases....";
85	fi
86
87	if [ "$FREEZER" = "freezer" ]
88	then
89		pushd $LTPROOT/testcases/kernel/controllers/freezer
90		./run.sh
91		popd
92	else
93		echo "CONTROLLERS TESTCASES: WARNING";
94		echo "Kernel does not support freezer controller";
95		echo "Skipping all freezer testcases....";
96	fi
97	if [ "$CPUSET_CONTROLLER" = "cpuset" ]
98	then
99		$LTPROOT/testcases/bin/run_cpuset_test.sh 1;
100		$LTPROOT/testcases/bin/run_cpuset_test.sh 2;
101		$LTPROOT/testcases/bin/run_cpuset_test.sh 3;
102		$LTPROOT/testcases/bin/run_cpuset_test.sh 4;
103		$LTPROOT/testcases/bin/run_cpuset_test.sh 5;
104		$LTPROOT/testcases/bin/run_cpuset_test.sh 6;
105		$LTPROOT/testcases/bin/run_cpuset_test.sh 7;
106		$LTPROOT/testcases/bin/run_cpuset_test.sh 8;
107		$LTPROOT/testcases/bin/run_cpuset_test.sh 9;
108		$LTPROOT/testcases/bin/run_cpuset_test.sh 10;
109		$LTPROOT/testcases/bin/run_cpuset_test.sh 11;
110	else
111		echo "CONTROLLERS TESTCASES: WARNING";
112		echo "Kernel does not support cpuset controller";
113		echo "Skipping all cpuset controller testcases....";
114	fi
115else
116	echo "CONTROLLERS TESTCASES: WARNING"
117	echo "Kernel does not support for control groups";
118	echo "Skipping all controllers testcases....";
119fi
120
121exit 0;
122