Hi,
This test removes the common shell functions from run scripts and puts them
into a separate file parameters.sh.
<cpuctl5-cleanup.patch>
Signed-off-by: Sudhir Kumar <[EMAIL PROTECTED]>
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/Makefile
===================================================================
--- ltp-full-20080131.orig/testcases/kernel/controllers/cpuctl/Makefile
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/Makefile
@@ -12,5 +12,5 @@ clean:
rm -f $(TARGETS) *.o
install:
- @set -e; for i in $(TARGETS) run_cpuctl_test.sh ; do ln -f $$i
../../../bin/$$i ; chmod +x $$i ; done
+ @set -e; for i in $(TARGETS) run_cpuctl_test.sh parameters.sh ; do ln
-f $$i ../../../bin/$$i ; chmod +x $$i ; done
Index: ltp-full-20080131/testcases/kernel/controllers/cpuctl/parameters.sh
===================================================================
--- /dev/null
+++ ltp-full-20080131/testcases/kernel/controllers/cpuctl/parameters.sh
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+get_num_groups() # Number of tasks should be >= number of cpu's (to
check scheduling fairness)
+{
+ num_grps=$(echo "$NUM_CPUS * 1.5"|bc) # temp variable num_grps
+ int_part=`echo $num_grps | cut -d"." -f1`
+ dec_part=`echo $num_grps | cut -d"." -f2`
+
+ if [ $dec_part -gt 0 ]
+ then
+ NUM_GROUPS=$(echo "$int_part + 1"|bc)
+ else
+ NUM_GROUPS=$int_part;
+ fi
+}
+
+ # Write the cleanup function
+cleanup ()
+{
+ echo "Cleanup called";
+ rm -f cpuctl_task_* 2>/dev/null
+ rmdir /dev/cpuctl/group_* 2> /dev/null
+ umount /dev/cpuctl 2> /dev/null
+ rmdir /dev/cpuctl 2> /dev/null
+ rm -f myfifo 2>/dev/null
+
+}
+ # Create /dev/cpuctl & mount the cgroup file system with cpu
controller
+ #clean any group created eralier (if any)
+
+setup ()
+{
+ if [ -e /dev/cpuctl ]
+ then
+ echo "WARN:/dev/cpuctl already exist..overwriting"; # or a
warning ?
+ cleanup;
+ mkdir /dev/cpuctl;
+ else
+ mkdir /dev/cpuctl
+ fi
+ mount -t cgroup -ocpu cgroup /dev/cpuctl 2> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo "ERROR: Could not mount cgroup filesystem on
/dev/cpuctl..Exiting test";
+ cleanup;
+ exit -1;
+ fi
+
+ # Group created earlier may again be visible if not cleaned
properly...so clean them
+ if [ -e /dev/cpuctl/group_1 ]
+ then
+ rmdir /dev/cpuctl/group*
+ echo "WARN: Earlier groups found and removed...";
+ fi
+
+ #Create a fifo to make all tasks wait on it
+ mkfifo myfifo 2> /dev/null;
+ if [ $? -ne 0 ]
+ then
+ echo "ERROR: Can't create fifo...Check your
permissions..Exiting test";
+ cleanup;
+ exit -1;
+ fi
+
+ # Create different groups
+ i=1;
+ while [ "$i" -le "$NUM_GROUPS" ]
+ do
+ group=group_$i;
+ mkdir /dev/cpuctl/$group;# 2>/dev/null
+ if [ $? -ne 0 ]
+ then
+ echo "ERROR: Can't create $group...Check your
permissions..Exiting test";
+ cleanup;
+ exit -1;
+ fi
+ i=`expr $i + 1`
+ done
+}
+
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
@@ -61,83 +61,7 @@ PWD=`pwd`
cd $LTPROOT/testcases/bin/
NUM_CPUS=`cat /proc/cpuinfo | grep -w processor | wc -l`
-get_num_groups() # Number of tasks should be >= number of cpu's (to
check scheduling fairness)
-{
- num_grps=$(echo "$NUM_CPUS * 1.5"|bc) # temp variable num_grps
- int_part=`echo $num_grps | cut -d"." -f1`
- dec_part=`echo $num_grps | cut -d"." -f2`
-
- if [ $dec_part -gt 0 ]
- then
- NUM_GROUPS=$(echo "$int_part + 1"|bc)
- else
- NUM_GROUPS=$int_part;
- fi
-}
-
-# Write the cleanup function
-cleanup ()
-{
- echo "Cleanup called"
- rm -f cpuctl_task_* 2>/dev/null
- rmdir /dev/cpuctl/group_* 2> /dev/null
- umount /dev/cpuctl 2> /dev/null
- rmdir /dev/cpuctl 2> /dev/null
- rm -f myfifo 2>/dev/null
-
-}
- # Create /dev/cpuctl & mount the cgroup file system with cpu controller
- #clean any group created eralier (if any)
-
-setup ()
-{
- if [ -e /dev/cpuctl ]
- then
- echo "WARN:/dev/cpuctl already exist..overwriting"; # or a
warning ?
- cleanup;
- mkdir /dev/cpuctl;
- else
- mkdir /dev/cpuctl
- fi
- mount -t cgroup -ocpu cgroup /dev/cpuctl 2> /dev/null
- if [ $? -ne 0 ]
- then
- echo "ERROR: Could not mount cgroup filesystem on
/dev/cpuctl..Exiting test";
- cleanup;
- exit -1;
- fi
-
- # Group created earlier may again be visible if not cleaned
properly...so clean them
- if [ -e /dev/cpuctl/group_1 ]
- then
- rmdir /dev/cpuctl/group*
- echo "WARN: Earlier groups found and removed...";
- fi
-
- #Create a fifo to make all tasks wait on it
- mkfifo myfifo 2> /dev/null;
- if [ $? -ne 0 ]
- then
- echo "ERROR: Can't create fifo...Check your
permissions..Exiting test";
- cleanup;
- exit -1;
- fi
-
- # Create different groups
- i=1;
- while [ "$i" -le "$NUM_GROUPS" ]
- do
- group=group_$i;
- mkdir /dev/cpuctl/$group;# 2>/dev/null
- if [ $? -ne 0 ]
- then
- echo "ERROR: Can't create $group...Check your
permissions..Exiting test";
- cleanup;
- exit -1;
- fi
- i=`expr $i + 1`
- done
-}
+. parameters.sh
########################## main #######################
case ${TEST_NUM} in
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