Hi,

This patch adds the tenth testcase(stress) for cpu controller.
<cpuctl-stress3.patch>

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

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
@@ -27,7 +27,7 @@
 /*              testcase tests the ability of the cpu controller to provide   
*/
 /*              fairness for share values (absolute).                         
*/
 /*                                                                            
*/
-/* Total Tests: 1                                                             
*/
+/* Total Tests: 2                                                             
*/
 /*                                                                            
*/
 /* Test Name:   cpu_controller_test04                                         
*/
 /*                                                                            
*/
@@ -62,7 +62,7 @@
 
 extern int Tst_count;
 char *TCID = "cpu_controller_test06";
-int TST_TOTAL = 1;
+int TST_TOTAL = 2;
 pid_t scriptpid;
 extern void
 cleanup()
@@ -106,7 +106,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)) <= 4) && 
((test_num =atoi(test_num_p)) >= 1)))
+       if ((test_num_p != NULL) && (((test_num = atoi(test_num_p)) <= 5) && 
((test_num =atoi(test_num_p)) >= 4)))
        {
                if ((group_num_p != NULL) && (mygroup_p != NULL) && \
                        (script_pid_p != NULL) && (num_cpus_p != NULL) && 
(task_num_p != NULL))
@@ -133,7 +133,9 @@ 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 
*/
-       write_to_file (mysharesfile, "w", mygroup_shares);    /* Write the 
shares of the group*/
+       if (test_num == 4)
+               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*/
 
        fd = open ("./myfifo", 0);
@@ -170,7 +172,7 @@ int main(int argc, char* argv[])
                else
                        mytime =  (delta_cpu_time * 100) / (TIME_INTERVAL * 
num_cpus);
 
-               fprintf (stdout,"Group-%3d(Shares-%4u) task_num:%3d cpu time--> 
%6.3f\%(%6.3fs)\tinterval:%lu\n",
+               fprintf (stdout,"Group-%3d:Shares-%4u: task_num:%3d cpu time--> 
%6.3f\%(%6.3fs)\tinterval:%lu\n",
                mygroup_num, mygroup_shares, task_num, mytime, delta_cpu_time, 
delta_time);
                counter++;
 
@@ -181,6 +183,9 @@ int main(int argc, char* argv[])
                        case 4:
                                exit (0);               /* This task is done 
with its job*/
                                break;
+                       case 5:
+                               exit (0);               /* This task is done 
with its job*/
+                               break;
                        default:
                                tst_brkm (TBROK, cleanup, "Invalid test number 
passed\n");
                                break;
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
@@ -118,6 +118,12 @@ usage ()
                FILE="stress-4";
                echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
                ;;
+       "5" )   # Heavy stress test
+               NUM_GROUPS=2;
+               M=`expr $N \* 100`;
+               FILE="stress-5";
+               echo `date` >> $LTPROOT/output/cpuctl_results_$FILE.txt;
+               ;;
          * )
                usage;
                ;;
@@ -233,6 +239,51 @@ usage ()
                fi;
                TOTAL_TASKS=$TASK_NUM;
                ;;
+       "5" )
+
+               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 "===============================" >> 
$LTPROOT/output/cpuctl_results_$FILE.txt;
+
+               for i in $(seq 1 $NUM_GROUPS)
+               do
+                       MYGROUP=/dev/cpuctl/group_$i;
+                       if [ $i -eq 1 ]
+                       then
+                               TASKS_IN_GROUP=$N;
+                       else
+                               TASKS_IN_GROUP=$M;
+                       fi;
+                       for j in $(seq 1 $TASKS_IN_GROUP)
+                       do
+                       TASK_NUM=`expr $TASK_NUM + 1`;
+                       cp cpuctl_test04 cpuctl_task_$TASK_NUM 2>/dev/null;
+                       chmod +x cpuctl_task_$TASK_NUM;
+
+                       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_$FILE.txt 2>/dev/null &
+                       if [ $? -ne 0 ]
+                       then
+                               echo "Error: Could not run 
./cpuctl_task_$TASK_NUM"
+                               cleanup;
+                               exit -1;
+                       else
+                               PID[$TASK_NUM]=$!;
+                       fi;
+                       j=`expr $j + 1`
+                       done;           # end j loop
+                       i=`expr $i + 1`
+               done;                   # end i loop
+               else
+                       echo "Source file not compiled..Plz check 
Makefile...Exiting test"
+                       cleanup;
+                       exit -1;
+               fi;
+               TOTAL_TASKS=$TASK_NUM;
+               ;;
          * )
                usage;
                ;;
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
@@ -47,6 +47,7 @@ then
                $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;
        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