The patch adds a script which runs the load tasks and the latency check task.
The script creates setup for both the tests(with and without cpu controller)

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

Index: 
ltp-full-20081130/testcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh
===================================================================
--- /dev/null
+++ 
ltp-full-20081130/testcases/kernel/controllers/cpuctl/run_cpuctl_latency_test.sh
@@ -0,0 +1,176 @@
+#!/bin/bash
+# usage ./runcpuctl_latency_test.sh
+
+###############################################################################
+#  Copyright (c) International Business Machines  Corp., 2008                 #
+#                                                                             #
+#  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: run_cpuctl_test.sh                                            #
+#                                                                             #
+# Description: This file runs the setup for testing latency under heavy load  #
+#              when group scheduling is enabled                               #
+#              After setup it runs diff test cases in diff setup.             #
+#                                                                             #
+# Test 01:     Tests latency when no cgroup is mounted                        #
+#                                                                             #
+#                                                                             #
+# Author:       Sudhir Kumar   <[EMAIL PROTECTED]>                    #
+#                                                                             #
+# History:                                                                    #
+#                                                                             #
+#  DATE         NAME           EMAIL                         DESC             #
+#                                                                             #
+#  26/11/08  Sudhir Kumar <[EMAIL PROTECTED]>   Created this test     #
+#                                                                             #
+###############################################################################
+
+
+NUM_TASKS=500;
+NUM_GROUPS=2;  #for default
+
+export TCID="cpuctl_latency_test";
+export TST_COUNT=1;
+export TST_TOTAL=2;
+
+. parameters.sh
+
+cleanup()
+{
+       local i;
+
+       if [ ! -z ${PID[1]} ]; then
+               for i in $(seq 1 $NUM_TASKS)
+               do
+                       kill -9 ${PID[$i]};
+               done
+       fi
+       if [ $TEST_NUM -eq 2 ]; then
+               for task in `cat /dev/cpuctl/group*/tasks`; do
+                       echo $task > /dev/cpuctl/tasks #2>/dev/null 1>&2;
+               done
+               rmdir /dev/cpuctl/group* #2> /dev/null
+               umount /dev/cpuctl #2> /dev/null
+               rmdir /dev/cpuctl #2> /dev/null
+               rm -f myfifo;
+       fi;
+}
+
+PWD=`pwd`
+
+################################
+# Start
+################################
+
+       TEST_NUM=$1;
+       if [ -z $TEST_NUM  ]; then
+               echo "Invalid test no passed to test script"
+               echo "Exiting the test..."
+               exit 1;
+       fi;
+
+       cd $LTPROOT/testcases/bin/ #Bad idea????????
+
+       # Check if sources are compiled
+       if [ ! -f $cpuctl_latency_test ] || [ ! -f $cpuctl_latency_check_task ]
+       then
+               echo "TBROK The sources are not compiled...."
+               cd $PWD;
+               exit 1;
+       fi
+
+       # Keep the signal handler ready
+       trap 'cleanup;' 0;
+
+       case $TEST_NUM in
+       "1")    #without creating any groups
+               # Run the load creating tasks
+               echo TINFO "Running cpuctl Latency Test 1"
+               for i in $(seq 1 $NUM_TASKS)
+               do
+                       # Execute the load tasks
+                       ./cpuctl_latency_test $TEST_NUM &
+                       if [ $? -ne 0 ]
+                       then
+                               echo "TBROK Failed to execute binary"
+                               exit;
+                       else
+                               PID[$i]=$!;
+                       fi
+               done
+
+               # Run the latency checking task
+               ./cpuctl_latency_check_task $TEST_NUM $$ &
+               if [ $? -ne 0 ]
+               then
+                       echo "TBROK Failled to execute main binary"
+                       exit;
+               else
+                       check_task=$!;
+               fi;
+               ;;
+
+       "2")    # With group scheduling
+               echo TINFO "Running cpuctl Latency Test 2"
+
+               NUM_CPUS=`cat /proc/cpuinfo | grep -w processor | wc -l`;
+               get_num_groups; # NUM_GROUPS is set now
+               do_setup;
+
+               for num in $(seq 1 $NUM_TASKS)
+               do
+                       group=/dev/cpuctl/group_`expr $num % $NUM_GROUPS + 1`;
+                       ./cpuctl_latency_test $TEST_NUM $group &
+                       if [ $? -ne 0 ]
+                       then
+                               echo "TBROK Failed to execute binary"
+                               exit;
+                       else
+                               PID[$i]=$!;
+                       fi;
+               done;
+
+               # Run the latency checking task in any group
+               ./cpuctl_latency_check_task $TEST_NUM $$ $group &
+               if [ $? -ne 0 ]
+               then
+                       echo "TBROK Failed to execute main binary";
+                       exit;
+               else
+                       check_task=$!;
+               fi;
+               ;;
+
+       * )     # wrong test num
+               echo TBROK "Invalid test number passed to the script"
+               exit;
+               ;;
+       esac;
+
+       wait $check_task;
+       RC=$?;  # Return status of the task being waited
+       # In abnormal termination of anyone trap will kill all others
+       # and they will return non zero exit status. So Test broke!!
+       if [ $RC -ne 0 ]
+       then
+               echo "Task $check_task exited abnormaly with return value: $RC";
+               echo TINFO "Test could'nt execute for expected duration";
+               cleanup;
+               cd $PWD;
+               exit -1;
+       fi
+
+       cd $PWD;



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to