Hi,

This patch does some cleanup.
<cpuctl-cleanup1.patch>

Signed-off-by: Sudhir Kumar <[EMAIL PROTECTED]>

Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -29,6 +29,10 @@
 /*                                                                            
*/
 /* Total Tests: 3                                                             
*/
 /*                                                                            
*/
+/* Test 01:     Tests if fairness persists among different runs               
*/
+/* Test 02:     Tests fairness with respect to absolute share values          
*/
+/* Test 03:     Granularity test with respect to shares values                
*/
+/*                                                                            
*/
 /* Test Name:   cpu_controller_test01                                         
*/
 /*                                                                            
*/
 /* Test Assertion                                                             
*/
@@ -92,7 +96,7 @@ int main(int argc, char* argv[])
        double exp_cpu_time;            /* Expected time in % as obtained by 
shares calculation */
        struct rusage cpu_usage;
        time_t current_time, prev_time, delta_time;
-       unsigned long int myshares = 1, baseshares = 1000;      /* Simply the 
base value to start with*/
+       unsigned long int myshares = 2, baseshares = 1000;      /* Simply the 
base value to start with*/
        unsigned int fmyshares, num_tasks;/* f-> from file. num_tasks is tasks 
in this group*/
        struct sigaction newaction, oldaction;
 
@@ -108,9 +112,9 @@ int main(int argc, char* argv[])
                tst_brkm (TBROK, cleanup, "Invalid input parameters\n");
        }
 
-       if (test_num == 1)
+       if (test_num == 1)      /* Test 01 & Test 02 */
                myshares *= my_group_num;
-       else if (test_num == 2)
+       else if (test_num == 3) /* Test 03 */
                myshares = baseshares;
        else
        {
@@ -150,8 +154,6 @@ int main(int argc, char* argv[])
        if (scan_shares_files() != 0)
                tst_brkm (TBROK, cleanup, "From function scan_shares_files in 
%s ", fullpath);
 
-//        fprintf(stdout, "The total shares are: %u\n", total_shares);
-
        /* return val: -1 in case of function error, else 2 is min share value 
*/
        if ((fmyshares = read_shares_file(mysharesfile)) < 2)
                tst_brkm (TBROK, cleanup, "in reading shares files  %s ", 
mysharesfile);
@@ -177,12 +179,14 @@ int main(int argc, char* argv[])
                        delta_time = current_time - prev_time;  /* Duration in 
case its not exact TIME_INTERVAL*/
 
                        getrusage (0, &cpu_usage);
-                       total_cpu_time = (cpu_usage.ru_utime.tv_sec + 
cpu_usage.ru_utime.tv_usec * 1e-6 + /* user time*/
-                                       cpu_usage.ru_stime.tv_sec + 
cpu_usage.ru_stime.tv_usec * 1e-6) ;  /* system time*/
+                       total_cpu_time = (cpu_usage.ru_utime.tv_sec + 
cpu_usage.ru_utime.tv_usec * 1e-6 + /*user*/
+                                       cpu_usage.ru_stime.tv_sec + 
cpu_usage.ru_stime.tv_usec * 1e-6) ;  /*sys*/
                                        delta_cpu_time = total_cpu_time - 
prev_cpu_time;
 
                        prev_cpu_time = total_cpu_time;
                        prev_time = current_time;
+
+                       /* calculate % cpu time each task gets */
                        if (delta_time > TIME_INTERVAL)
                                mytime =  (delta_cpu_time * 100) / (delta_time 
* num_cpus);
                        else
@@ -193,7 +197,7 @@ with %lu(shares) in %lu (s) INTERVAL\n",
 exp_cpu_time, myshares, delta_time);
                        first_counter++;
 
-                       if (first_counter >= NUM_INTERVALS)      /* Take n sets 
of readings for each shares value*/
+                       if (first_counter >= NUM_INTERVALS)     /* Take n sets 
of readings for each shares value*/
                        {
                                first_counter = 0;
                                second_counter++;
@@ -215,7 +219,7 @@ exp_cpu_time, myshares, delta_time);
                                                 myshares -= baseshares * 
GRANULARITY / 100;
                                 }
                                write_to_file (mysharesfile, "w", myshares);
-                               if (test_num == 2)
+                               if (test_num == 3)
                                {
                                /*
                                 * Read the shares file and again calculate the 
cpu fraction
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -27,7 +27,10 @@
 /*              testcase tests the ability of the cpu controller to provide   
*/
 /*              fairness for share values (absolute).                         
*/
 /*                                                                            
*/
-/* Total Tests: 1                                                             
*/
+/* Total Tests: 2                                                             
*/
+/*                                                                            
*/
+/* Test 04:     Nice value effect on group scheduling                         
*/
+/* Test 05:     Task migration test                                           
*/
 /*                                                                            
*/
 /* Test Name:   cpu_controller_test02                                         
*/
 /*                                                                            
*/
@@ -59,13 +62,14 @@
 #include "test.h"              /* LTP harness APIs*/
 
 #define TIME_INTERVAL  60      /* Time interval in seconds*/
-#define NUM_INTERVALS  4       /* How many iterations of TIME_INTERVAL */
+#define NUM_INTERVALS  3       /* How many iterations of TIME_INTERVAL */
 
 extern int Tst_count;
 char *TCID = "cpu_controller_test04";
 int TST_TOTAL = 1;
 pid_t scriptpid;
 char path[] = "/dev/cpuctl";
+
 extern void
 cleanup()
 {
@@ -85,7 +89,7 @@ int main(int argc, char* argv[])
        /* Following variables are to capture parameters from script*/
        char *group_num_p, *mygroup_p, *script_pid_p, *num_cpus_p, *test_num_p, 
*task_num_p;
        pid_t pid;
-       int my_group_num,               /* A number attached with a group*/
+       int mygroup_num,                /* A number attached with a group*/
                fd,                     /* A descriptor to open a fifo for 
synchronized start*/
                counter =0;             /* To take n number of readings*/
        double total_cpu_time,          /* Accumulated cpu time*/
@@ -111,12 +115,12 @@ int main(int argc, char* argv[])
        test_num_p      = getenv("TEST_NUM");
        task_num_p      = getenv("TASK_NUM");
        /* Check if all of them are valid */
-       if ((test_num_p != NULL) && (((test_num = atoi(test_num_p)) == 3) || 
((test_num =atoi(test_num_p)) == 4)))
+       if ((test_num_p != NULL) && (((test_num = atoi(test_num_p)) == 4) || 
((test_num =atoi(test_num_p)) == 5)))
        {
                if ((group_num_p != NULL) && (mygroup_p != NULL) && \
                        (script_pid_p != NULL) && (num_cpus_p != NULL) && 
(task_num_p != NULL))
                {
-                       my_group_num     = atoi(group_num_p);
+                       mygroup_num      = atoi(group_num_p);
                        scriptpid        = atoi(script_pid_p);
                        num_cpus         = atoi (num_cpus_p);
                        task_num         = atoi (task_num_p);
@@ -193,13 +197,15 @@ int main(int argc, char* argv[])
 
                prev_cpu_time = total_cpu_time;
                prev_time = current_time;
+
+               /* calculate % cpu time each task gets */
                if (delta_time > TIME_INTERVAL)
                        mytime =  (delta_cpu_time * 100) / (delta_time * 
num_cpus);
                else
                        mytime =  (delta_cpu_time * 100) / (TIME_INTERVAL * 
num_cpus);
 
                 fprintf (stdout,"Grp:-%3d task-%3d:CPU TIME{calc:-%6.2f(s)i.e. 
%6.2f(\%) exp:-%6.2f(\%)}\
-with %lu(shares) in %lu (s) INTERVAL\n",my_group_num, task_num, 
delta_cpu_time, mytime,\
+with %lu(shares) in %lu (s) INTERVAL\n",mygroup_num, task_num, delta_cpu_time, 
mytime,\
 exp_cpu_time, fmyshares, delta_time);
 
                counter++;
@@ -208,10 +214,10 @@ exp_cpu_time, fmyshares, delta_time);
                {
                switch (test_num)
                        {
-                       case 3:
-                               exit (0);               /* This task is done 
with its job*/
+                       case 4:                 /* Test04 */
+                               exit (0);       /* This task is done with its 
job*/
                                break;
-                       case 4:
+                       case 5:                 /* Test 05 */
                                if (migrate == 0)
                                {
                                        counter = 0;
@@ -238,6 +244,7 @@ exp_cpu_time, fmyshares, delta_time);
                                        tst_brkm (TFAIL, cleanup, "Could not 
migrate task 1 ");
                                else
                                        fprintf (stdout, "TASK 1 MIGRATED FROM 
GROUP 1 TO GROUP 2\n");
+                               strcpy (mytaskfile, 
"/dev/cpuctl/group_2/tasks"); 
                        }
                        /*
                         * Read the shares files and again calculate the cpu 
fraction
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -24,12 +24,16 @@
 /*                                                                            
*/
 /* Description: This is a c program that tests the cpucontroller fairness of  
*/
 /*              scheduling the tasks according to their group shares. This    
*/
-/*              testcase tests the ability of the cpu controller to provide   
*/
-/*              fairness for share values (absolute).                         
*/
+/*              testcase tests the scheduling fairness with respect to number 
*/
+/*              of classes and number of jobs in each class                   
*/
 /*                                                                            
*/
 /* Total Tests: 1                                                             
*/
 /*                                                                            
*/
-/* Test Name:   cpu_controller_test02                                         
*/
+/* Test 6:      N X M (N groups with M tasks each)                            
*/
+/* Test 7:      N*M X 1 (N*M groups with 1 task each)                         
*/
+/* Test 8:      1 X N*M (1 group with N*M tasks each)                         
*/
+/*                                                                            
*/
+/* Test Name:   cpu_controller_test03                                         
*/
 /*                                                                            
*/
 /* Test Assertion                                                             
*/
 /*              Please refer to the file cpuctl_testplan.txt                  
*/
@@ -83,7 +87,7 @@ int main(int argc, char* argv[])
        /* Following variables are to capture parameters from script*/
        char *group_num_p, *mygroup_p, *script_pid_p, *num_cpus_p, *test_num_p, 
*task_num_p;
        pid_t pid;
-       int my_group_num,               /* A number attached with a group*/
+       int mygroup_num,                /* A number attached with a group*/
                fd,                     /* A descriptor to open a fifo for 
synchronized start*/
                counter =0;             /* To take n number of readings*/
        double total_cpu_time,          /* Accumulated cpu time*/
@@ -109,12 +113,12 @@ int main(int argc, char* argv[])
        test_num_p      = getenv("TEST_NUM");
        task_num_p      = getenv("TASK_NUM");
        /* Check if all of them are valid */
-       if ((test_num_p != NULL) && (((test_num = atoi(test_num_p)) <= 3) && 
((test_num =atoi(test_num_p)) >= 1)))
+       if ((test_num_p != NULL) && (((test_num = atoi(test_num_p)) <= 8) && 
((test_num =atoi(test_num_p)) >= 6)))
        {
                if ((group_num_p != NULL) && (mygroup_p != NULL) && \
                        (script_pid_p != NULL) && (num_cpus_p != NULL) && 
(task_num_p != NULL))
                {
-                       my_group_num     = atoi(group_num_p);
+                       mygroup_num      = atoi(group_num_p);
                        scriptpid        = atoi(script_pid_p);
                        num_cpus         = atoi (num_cpus_p);
                        task_num         = atoi (task_num_p);
@@ -191,13 +195,15 @@ int main(int argc, char* argv[])
 
                prev_cpu_time = total_cpu_time;
                prev_time = current_time;
+
+               /* calculate % cpu time each task gets */
                if (delta_time > TIME_INTERVAL)
                        mytime =  (delta_cpu_time * 100) / (delta_time * 
num_cpus);
                else
                        mytime =  (delta_cpu_time * 100) / (TIME_INTERVAL * 
num_cpus);
 
                 fprintf (stdout,"Grp:-%3d task-%3d:CPU TIME{calc:-%6.2f(s)i.e. 
%6.2f(\%) exp:-%6.2f(\%)}\
- in %lu (s) INTERVAL\n",my_group_num, task_num, delta_cpu_time, mytime,\
+ in %lu (s) INTERVAL\n",mygroup_num, task_num, delta_cpu_time, mytime,\
 exp_cpu_time, delta_time);
 
                counter++;
@@ -206,9 +212,9 @@ exp_cpu_time, delta_time);
                {
                switch (test_num)
                        {
-                       case 1:
-                       case 2:
-                       case 3:
+                       case 6:                 /* Test 06 */
+                       case 7:                 /* Test 07 */
+                       case 8:                 /* Test 08 */
                                exit (0);               /* This task is done 
with its job*/
                                break;
                        default:
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -29,6 +29,9 @@
 /*                                                                            
*/
 /* Total Tests: 2                                                             
*/
 /*                                                                            
*/
+/* Test 09:     Heavy stress test with nice value change                      
*/
+/* Test 10:     Heavy stress test (effect of heavy group on light group)      
*/
+/*                                                                            
*/
 /* Test Name:   cpu_controller_test04                                         
*/
 /*                                                                            
*/
 /* Test Assertion                                                             
*/
@@ -109,7 +112,7 @@ int main(int argc, char* argv[])
        test_num_p      = getenv("TEST_NUM");
        task_num_p      = getenv("TASK_NUM");
        /* Check if all of them are valid */
-       if ((test_num_p != NULL) && (((test_num = atoi(test_num_p)) <= 5) && 
((test_num =atoi(test_num_p)) >= 4)))
+       if ((test_num_p != NULL) && (((test_num =atoi(test_num_p)) <= 10) && 
((test_num =atoi(test_num_p)) >= 9)))
        {
                if ((group_num_p != NULL) && (mygroup_p != NULL) && \
                        (script_pid_p != NULL) && (num_cpus_p != NULL) && 
(task_num_p != NULL))
@@ -136,7 +139,7 @@ int main(int argc, char* argv[])
        sprintf(mysharesfile, "%s", mygroup);
        strcat (mysharesfile,"/cpu.shares");
        /* Need some technique so as only 1 task per grp writes to shares file 
*/
-       if (test_num == 4)
+       if (test_num == 9)
                write_to_file (mysharesfile, "w", mygroup_shares);    /* Write 
the shares of the group*/
 
        write_to_file (mytaskfile, "a", getpid());    /* Assign the task to 
it's group*/
@@ -195,13 +198,15 @@ int main(int argc, char* argv[])
 
                prev_cpu_time = total_cpu_time;
                prev_time = current_time;
+
+               /* calculate % cpu time each task gets */
                if (delta_time > TIME_INTERVAL)
                        mytime =  (delta_cpu_time * 100) / (delta_time * 
num_cpus);
                else
                        mytime =  (delta_cpu_time * 100) / (TIME_INTERVAL * 
num_cpus);
 
                 fprintf (stdout,"Grp:-%3d task-%3d:CPU TIME{calc:-%6.2f(s)i.e. 
%6.2f(\%) exp:-%6.2f(\%)}\
-with %lu shares in %lu (s) INTERVAL\n",mygroup_num, task_num, delta_cpu_time, 
mytime,\
+with %3lu shares in %lu (s) INTERVAL\n",mygroup_num, task_num, delta_cpu_time, 
mytime,\
 exp_cpu_time, fmyshares, delta_time);
 
                counter++;
@@ -210,10 +215,10 @@ exp_cpu_time, fmyshares, delta_time);
                {
                switch (test_num)
                        {
-                       case 4:
-                               exit (0);               /* This task is done 
with its job*/
+                       case 9:                 /* Test 09 */
+                               exit (0);       /* This task is done with its 
job*/
                                break;
-                       case 5:
+                       case 10:                        /* Test 10 */
                                exit (0);               /* This task is done 
with its job*/
                                break;
                        default:
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/parameters.sh
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/parameters.sh
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/parameters.sh
@@ -1,4 +1,45 @@
 #!/bin/bash
+# usage ./parameters.sh
+
+#################################################################################
+#  Copyright (c) International Business Machines  Corp., 2007                  
 #
+#                                                                              
 #
+#  This program is free software;  you can redistribute it and/or modify       
 #
+#  it under the terms of the GNU General Public License as published by        
 #
+#  the Free Software Foundation; either version 2 of the License, or           
 #
+#  (at your option) any later version.                                         
 #
+#                                                                              
 #
+#  This program is distributed in the hope that it will be useful,             
 #
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of             
 #
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See                   
 #
+#  the GNU General Public License for more details.                            
 #
+#                                                                              
 #
+#  You should have received a copy of the GNU General Public License           
 #
+#  along with this program;  if not, write to the Free Software                
 #
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA     
 #
+#                                                                              
 #
+#################################################################################
+# Name Of File: parameters.sh                                                  
 #
+#                                                                              
 #
+# Description:         This file has functions for the setup for testing 
cpucontroller #
+#               setup includes creating controller device, mounting it with    
 #
+#               cgroup filesystem with option cpu and creating groups in it.   
 #
+#                                                                              
 #
+# Functions:    get_num_groups(): decides number of groups based on num of 
cpus        #
+#               setup(): creaes /dev/cpuctl, mounts cgroup fs on it, creates   
#
+#               groups in that, creates fifo to fire tasks at one time.        
 #
+#               cleanup(): Does full system cleanup                            
 #
+#                                                                              
 #
+# Author:       Sudhir Kumar   <[EMAIL PROTECTED]>                    #
+#                                                                              
 #
+# History:                                                                     
 #
+#                                                                              
 #
+#  DATE         NAME           EMAIL                        DESC               
#
+#                                                                              
 #
+#  20/12/07  Sudhir Kumar <[EMAIL PROTECTED]>   Created this test      #
+#                                                                              
 #
+#################################################################################
+
 
 get_num_groups()        # Number of tasks should be >= number of cpu's (to 
check scheduling fairness)
 {
Index: 
ltp-full-20080131/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
===================================================================
--- 
ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
+++ 
ltp-full-20080131/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
@@ -28,12 +28,11 @@
 #               This same script can run 4 testcases depending on test number  
 #
 #               depending on the test number passed by the calling script.     
 #
 #                                                                              
 #
-# Functions:    get_num_groups(): decides num of groups based on num of cpus   
 #
-#               setup(): creaes /dev/cpuctl, mounts cgroup fs on it, creates   
 #
-#               groups in that, creates fifo to fire tasks at one time.        
 #
-#               cleanup(): Does the required cleanup after running test.       
 #
-#               usage(): Displays the usage of the script.                     
 #
-#               Common functions are kept in a file parameters.sh              
 #
+# Test 06:      N X M (N groups with M tasks each)                             
 #
+# Test 07:      N*M X 1 (N*M groups with 1 task each)                          
 #
+# Test 08:      1 X N*M (1 group with N*M tasks)                               
 #
+# Test 09:      Heavy stress test with nice value change                       
 #
+# Test 10:      Heavy stress test (effect of heavy group on light group)       
 #
 #                                                                              
 #
 # Precaution:   Avoid system use by other applications/users to get fair and   
 #
 #               appropriate results                                            
 #
@@ -62,7 +61,8 @@ TOTAL_TASKS=0;                # Total num of tasks in 
 TASKS_IN_GROUP=0;      # Total num of tasks in a group
 NICEVALUE=0;
 SCRIPT_PID=$$;
-FILE="stress-123";     # suffix for results file
+FILE="stress-678";             # suffix for results file
+TEST_NAME="CPUCTL NUM_GROUPS vs NUM_TASKS TEST:";
 
 NUM_CPUS=`cat /proc/cpuinfo | grep -w processor | wc -l`
 N=$NUM_CPUS;           # Default total num of groups (classes)
@@ -87,7 +87,7 @@ usage ()
 
        case ${TEST_NUM} in
 
-       "1" )   # N X M (N groups with M tasks each)
+       "6" )   # N X M (N groups with M tasks each)
                if [ $N -eq 1 ]
                then
                        N=2;    # Min 2 groups for group scheduling
@@ -96,7 +96,7 @@ usage ()
                TASKS_IN_GROUP=$M;
                echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
                ;;
-       "2" )   # N*M X 1 (N*M groups with 1 task each)
+       "7" )   # N*M X 1 (N*M groups with 1 task each)
                if [ $N -eq 1 ]
                then
                        N=2;    # To keep total tasks same as in case 1
@@ -104,7 +104,7 @@ usage ()
                NUM_GROUPS=`expr $N \* $M`;
                TASKS_IN_GROUP=1;
                ;;
-       "3" )   # 1 X N*M (1 group with N*M tasks)
+       "8" )   # 1 X N*M (1 group with N*M tasks)
                if [ $N -eq 1 ]
                then
                        N=2;    # To keep total tasks same as in case 1
@@ -112,16 +112,18 @@ usage ()
                NUM_GROUPS=1;
                TASKS_IN_GROUP=`expr $N \* $M`;
                ;;
-       "4" )   # Heavy stress test
+       "9" )   # Heavy stress test
                NUM_GROUPS=`expr $N \* $M`;
                TASKS_IN_GROUP=`expr 1 \* $M`;
-               FILE="stress-4";
+               FILE="stress-9";
+               TEST_NAME="HEAVY STRESS TEST(RENICED):";
                echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
                ;;
-       "5" )   # Heavy stress test
+       "10" )  # Heavy stress test
                NUM_GROUPS=2;
                M=`expr $N \* 100`;
-               FILE="stress-5";
+               FILE="stress-10";
+               TEST_NAME="LIGHT GRP vs HEAVY GRP TEST:";
                echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
                ;;
          * )
@@ -142,11 +144,11 @@ usage ()
 
        case $TEST_NUM in
 
-       "1" | "2" | "3" )
+       "6" | "7" | "8" )
 
                if [ -f cpuctl_test03 ]
                then
-               echo CPUCTL NUM_GROUPS vs NUM_TASKS TEST $TEST_NUM >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TEST NAME:- $TEST_NAME: $TEST_NUM >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                echo Test $TEST_NUM: NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                echo Test $TEST_NUM: TASKS PER GROUP=$TASKS_IN_GROUP >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                echo "==========================================" >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
@@ -181,13 +183,13 @@ usage ()
                fi;
                TOTAL_TASKS=$TASK_NUM;
                ;;
-       "4" )
+       "9" )
 
                if [ -f cpuctl_test04 ]
                then
-               echo CPU CONTROLLER HEAVY STRESS TEST 4: >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
-               echo Test $TEST_NUM: NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
-               echo Test $TEST_NUM: TASKS PER GROUP=$TASKS_IN_GROUP >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TEST NAME:- $TEST_NAME: $TEST_NUM >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TASKS PER GROUP=$TASKS_IN_GROUP >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                echo "===============================" >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
 
                # Create 4 priority windows
@@ -239,12 +241,13 @@ usage ()
                fi;
                TOTAL_TASKS=$TASK_NUM;
                ;;
-       "5" )
+       "10" )
 
                if [ -f cpuctl_test04 ]
                then
-               echo CPU CONTROLLER HEAVY STRESS TEST 5: >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
-               echo Test $TEST_NUM: NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TEST NAME:- $TEST_NAME: $TEST_NUM >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TASKS PER GROUP=VARIABLE >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                echo "===============================" >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
 
                for i in $(seq 1 $NUM_GROUPS)
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
===================================================================
--- 
ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-# usage ./runcpuctl_test.sh
+# usage ./runcpuctl_test.sh test_num
 
 
#################################################################################
 #  Copyright (c) International Business Machines  Corp., 2007                  
 #
@@ -21,14 +21,14 @@
 
#################################################################################
 # Name Of File: run_cpuctl_test.sh                                             
 #
 #                                                                              
 #
-# Description:         This file runs the setup for testing cpucontroller.     
        #
-#               After setup it runs some of the tasks in different groups.     
 #
-#               setup includes creating controller device, mounting it with    
 #
-#               cgroup filesystem with option cpu and creating groups in it.   
 #
-#                                                                              
 #
-# Functions:    get_num_groups(): decides number of groups based on num of 
cpus        #
-#               setup(): creaes /dev/cpuctl, mounts cgroup fs on it, creates   
#
-#               groups in that, creates fifo to fire tasks at one time.        
 #
+# Description: This file runs the setup for testing diff cpucontroller 
feature. #
+#              After setup it runs diff test cases in diff setup.              
 #
+#                                                                              
 #
+# Test 01:     Tests if fairness persists among different runs                 
 #
+# Test 02:     Tests fairness with respect to absolute share values            
 #
+# Test 03:     Granularity test with respect to shares values                  
 #
+# Test 04:     Nice value effect on group scheduling                           
 #
+# Test 05:     Task migration test                                             
 #
 #                                                                              
 #
 # Precaution:   Avoid system use by other applications/users to get fair and   
 #
 #               appropriate results                                            
 #
@@ -65,10 +65,22 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
 
 ##########################  main   #######################
        case ${TEST_NUM} in
-       "1" )   get_num_groups;;
-       "2" )   NUM_GROUPS=`expr 2 \* $NUM_CPUS`;;
-       "3" )   NUM_GROUPS=$NUM_CPUS;;
-       "4" )   NUM_GROUPS=$NUM_CPUS;;
+       "1" )   get_num_groups; # contains test case 1 and 2
+               TEST_NAME="FAIRNESS TEST:"
+               FILE="12";
+               ;;
+       "3" )   NUM_GROUPS=`expr 2 \* $NUM_CPUS`;
+               TEST_NAME="GRANULARITY TEST:";
+               FILE=$TEST_NUM;
+               ;;
+       "4" )   NUM_GROUPS=$NUM_CPUS;
+               TEST_NAME="NICE VALUE TEST:";
+               FILE=$TEST_NUM;
+               ;;
+       "5" )   NUM_GROUPS=$NUM_CPUS;
+               TEST_NAME=" TASK MIGRATION TEST:";
+               FILE=$TEST_NUM;
+               ;;
         *  )   echo "Could not start cpu controller test";
                echo "usage: run_cpuctl_test.sh test_num";
                echo "Skipping the test...";
@@ -86,15 +98,19 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
        #Check if  c source  file has been compiled and then run it in 
different groups
 
        case $TEST_NUM in
-       "1" | "2" )
+       "1" | "3" )
                if [ -f cpuctl_test01 ]
                then
-               echo `date` >> $LTPROOT/output/cpuctl_results_$TEST_NUM.txt;
+               echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo `uname -a` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TEST:- $TEST_NAME $TEST_NUM:  >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                for i in $(seq 1 $NUM_GROUPS)
                do
                        cp cpuctl_test01 cpuctl_task_$i 2>/dev/null;
                        chmod +x cpuctl_task_$i;
-                       ./cpuctl_task_$i $i /dev/cpuctl/group_$i $$ $NUM_CPUS 
$TEST_NUM >>$LTPROOT/output/cpuctl_results_$TEST_NUM.txt 2>/dev/null &
+                       ./cpuctl_task_$i $i /dev/cpuctl/group_$i $$ $NUM_CPUS 
$TEST_NUM \
+                        >>$LTPROOT/output/cpuctl_results_$FILE.txt 2>/dev/null 
&
                        if [ $? -ne 0 ]
                        then
                                echo "Error: Could not run ./cpuctl_task_$i"
@@ -112,10 +128,13 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
                fi;
                TOTAL_TASKS=$NUM_GROUPS;
                ;;
-       "3" )
+       "4" )
                if [ -f cpuctl_test02 ]
                then
-               echo `date` >> $LTPROOT/output/cpuctl_results_$TEST_NUM.txt;
+               echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo `uname -a` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TEST:- $TEST_NAME $TEST_NUM >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                for i in $(seq 1 $NUM_GROUPS)
                do
                        MYGROUP=/dev/cpuctl/group_$i
@@ -134,7 +153,7 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
 
                        GROUP_NUM=$i MYGROUP=$MYGROUP SCRIPT_PID=$SCRIPT_PID 
NUM_CPUS=$NUM_CPUS \
                        TEST_NUM=$TEST_NUM TASK_NUM=$TASK_NUM nice -n 
$NICELEVEL ./cpuctl_task_$TASK_NUM \
-                       >>$LTPROOT/output/cpuctl_results_$TEST_NUM.txt 
2>/dev/null &
+                       >>$LTPROOT/output/cpuctl_results_$FILE.txt 2>/dev/null &
                        if [ $? -ne 0 ]
                        then
                                echo "Error: Could not run 
./cpuctl_task_$TASK_NUM"
@@ -154,10 +173,13 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
                fi;
                TOTAL_TASKS=$TASK_NUM;
                ;;
-       "4" )
+       "5" )
                if [ -f cpuctl_test02 ]
                then
-               echo `date` >> $LTPROOT/output/cpuctl_results_$TEST_NUM.txt;
+               echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo `uname -a` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo TEST:- $TEST_NAME $TEST_NUM >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+               echo NUM_GROUPS=$NUM_GROUPS >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
                TASKS_IN_GROUP=3;
                for i in $(seq 1 $NUM_GROUPS)
                do
@@ -170,7 +192,7 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
 
                        GROUP_NUM=$i MYGROUP=$MYGROUP SCRIPT_PID=$SCRIPT_PID 
NUM_CPUS=$NUM_CPUS \
                        TEST_NUM=$TEST_NUM TASK_NUM=$TASK_NUM 
./cpuctl_task_$TASK_NUM \
-                       >>$LTPROOT/output/cpuctl_results_$TEST_NUM.txt 
2>/dev/null &
+                       >>$LTPROOT/output/cpuctl_results_$FILE.txt 2>/dev/null &
                        if [ $? -ne 0 ]
                        then
                                echo "Error: Could not run 
./cpuctl_task_$TASK_NUM"
@@ -217,7 +239,7 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
                fi
        done
        echo "Cpu controller test executed successfully.Results written to 
file";
-       echo "Please review the results in 
$LTPROOT/output/cpuctl_results_$TEST_NUM.txt"
+       echo "Please review the results in 
$LTPROOT/output/cpuctl_results_$FILE.txt"
        cleanup;
        cd $PWD
        exit 0;         #to let PAN reprt success of test
Index: ltp-full-20080131/testcases/kernel/controllers/test_controllers.sh
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/test_controllers.sh
+++ ltp-full-20080131/testcases/kernel/controllers/test_controllers.sh
@@ -40,14 +40,14 @@ then
        if [ "$CPU_CONTROLLER" = "cpu" ]
        then
                $LTPROOT/testcases/bin/run_cpuctl_test.sh 1;
-               $LTPROOT/testcases/bin/run_cpuctl_test.sh 2;
                $LTPROOT/testcases/bin/run_cpuctl_test.sh 3;
                $LTPROOT/testcases/bin/run_cpuctl_test.sh 4;
-               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 1;
-               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 2;
-               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 3;
-               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 4;
-               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 5;
+               $LTPROOT/testcases/bin/run_cpuctl_test.sh 5;
+               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 6;
+               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 7;
+               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 8;
+               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 9;
+               $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 10;
        else
                echo "CONTROLLERS TESTCASES: WARNING";
                echo "Kernel does not support for cpu controller";

Thanks,
Sudhir Kumar
LTC, ISTL


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to