Hi All,
Following is the patch that addresses the comments and does cleanup
for cpu controller testcases.
Signed-off-by: Sudhir Kumar <[EMAIL PROTECTED]>
Acked-by: Dhaval Giani <[EMAIL PROTECTED]>
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test01.c
@@ -38,10 +38,10 @@
/* Test Assertion
*/
/* Please refer to the file cpuctl_testplan.txt
*/
/*
*/
-/* Author: Sudhir Kumar [EMAIL PROTECTED] */
+/* Author: Sudhir Kumar [EMAIL PROTECTED] */
/*
*/
/* History:
*/
-/* Created- 20/12/2007 -Sudhir Kumar [EMAIL PROTECTED] */
+/* Created- 20/12/2007 -Sudhir Kumar <[EMAIL PROTECTED]> */
/*
*/
/******************************************************************************/
@@ -83,7 +83,7 @@ int timer_expired = 0;
int main(int argc, char* argv[])
{
- int num_cpus, test_num, len; /* num_cpus to
calculate cpu time in %*/
+ int num_cpus, test_num, len; /* Total time = TIME_INTERVAL *num_cpus
in the machine */
char mygroup[32], mytaskfile[32], mysharesfile[32], ch;
pid_t pid;
int my_group_num, /* A number attached with a group*/
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test02.c
@@ -37,10 +37,10 @@
/* Test Assertion
*/
/* Please refer to the file cpuctl_testplan.txt
*/
/*
*/
-/* Author: Sudhir Kumar [EMAIL PROTECTED] */
+/* Author: Sudhir Kumar [EMAIL PROTECTED] */
/*
*/
/* History:
*/
-/* Created- 20/12/2007 -Sudhir Kumar [EMAIL PROTECTED] */
+/* Created- 20/12/2007 -Sudhir Kumar <[EMAIL PROTECTED]> */
/*
*/
/******************************************************************************/
@@ -83,7 +83,7 @@ int timer_expired = 0;
int main(int argc, char* argv[])
{
- int test_num, task_num, len, num_cpus; /* num_cpus to calculate cpu
time in %*/
+ int test_num, task_num, len, num_cpus; /* Total time = TIME_INTERVAL
*num_cpus in the machine */
int migrate=0; /* For task migration*/
char mygroup[32], mytaskfile[32], mysharesfile[32], ch;
/* Following variables are to capture parameters from script*/
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test03.c
@@ -38,10 +38,10 @@
/* Test Assertion
*/
/* Please refer to the file cpuctl_testplan.txt
*/
/*
*/
-/* Author: Sudhir Kumar [EMAIL PROTECTED] */
+/* Author: Sudhir Kumar [EMAIL PROTECTED] */
/*
*/
/* History:
*/
-/* Created- 20/12/2007 -Sudhir Kumar [EMAIL PROTECTED] */
+/* Created- 20/12/2007 -Sudhir Kumar <[EMAIL PROTECTED]> */
/*
*/
/******************************************************************************/
@@ -82,7 +82,7 @@ int timer_expired = 0;
int main(int argc, char* argv[])
{
- int test_num, task_num, len, num_cpus; /* num_cpus to calculate cpu
time in %*/
+ int test_num, task_num, len, num_cpus; /* Total time = TIME_INTERVAL
*num_cpus in the machine */
char mygroup[32], mytaskfile[32], mysharesfile[32], ch;
/* 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;
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_test04.c
@@ -37,10 +37,10 @@
/* Test Assertion
*/
/* Please refer to the file cpuctl_testplan.txt
*/
/*
*/
-/* Author: Sudhir Kumar [EMAIL PROTECTED] */
+/* Author: Sudhir Kumar [EMAIL PROTECTED] */
/*
*/
/* History:
*/
-/* Created- 20/12/2007 -Sudhir Kumar [EMAIL PROTECTED] */
+/* Created- 20/12/2007 -Sudhir Kumar <[EMAIL PROTECTED]> */
/*
*/
/******************************************************************************/
@@ -82,7 +82,7 @@ int timer_expired = 0;
int main(int argc, char* argv[])
{
- int test_num, task_num, len, num_cpus; /* num_cpus to calculate cpu
time in %*/
+ int test_num, task_num, len, num_cpus; /* Total time = TIME_INTERVAL
*num_cpus in the machine */
char mygroup[64], mytaskfile[64], mysharesfile[64], ch;
/* 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;
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_testplan.txt
===================================================================
---
ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/cpuctl_testplan.txt
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/cpuctl_testplan.txt
@@ -42,14 +42,30 @@ fairness(as we will run 1 task per group
default each group is assigned 1024 shares. The cpu controller schedules the
tasks in different groups on the basis of the shares assigned to that group.
So the cpu usage of a task depends on the amount of shares it's group has out
-of the total number of shares(no upper limiit but a lower limit of 2). Let us
-say that we have 3 groups(1 task each) A,B,C each having 2, 4, 6 shares
+of the total number of shares(no upper limit but a lower limit of 2) and the
+number of tasks in that group(in this case only 1).
+So until and unless this ratio(group A' shares/ Total shares of all groups)
+changes, the cpu time for this group A remains constant.
+
+Let us say we have 3 groups(1 task each) A,B,C each having 2, 4, 6 shares
respectively. Hence if the tasks are running infinitely they are supposed to
get 16.66%, 33.33%, 50% cpu time respectively. This test case tests that each
group should get the cpu time in the same(above) ratio irrespective of the
-shares values provided the ratio is not changed i.e. the cpu time per group
-should not change if we change the shares from 2, 4, 6 to 200, 400, 600 or
-to 20K, 40K, 60K etc.
+shares absolute values provided the ratio is not changed i.e. the cpu time per
+group should not change if we change the shares from 2, 4, 6 to 200, 400, 600
or
+to 20K, 40K, 60K etc (provided the working conditions do not change).
+Thus the scheduling is proportional bandwidth scheduling and not absolute
+bandwidth scheduling.
+This was the test and outcome for test01. For test02 the setup is kept same.
+Test 02 tests if the fairness persists among different runs over a period of
+time. So in this test more than one sets of reading are taken and the expected
+outcome is that the cpu time for a task should remain constant among all the
+runs provided the working environment is same for the test.
+Currently the support to create an ideal environment for all the runs is not
+available in the test because of some required feature in the kernel. Hence
+there may be some variations among different runs depending on the execution
+of system default tasks which can run any time.
+The fix for this is supposed to be merged with next release.
How to view the results:
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/parameters.sh
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/parameters.sh
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/parameters.sh
@@ -30,13 +30,13 @@
# groups in that, creates fifo to fire tasks at one time.
#
# cleanup(): Does full system cleanup
#
#
#
-# Author: Sudhir Kumar <[EMAIL PROTECTED]> #
+# Author: Sudhir Kumar <[EMAIL PROTECTED]> #
#
#
# History:
#
#
#
-# DATE NAME EMAIL DESC
#
+# DATE NAME EMAIL DESC
#
#
#
-# 20/12/07 Sudhir Kumar <[EMAIL PROTECTED]> Created this test #
+# 20/12/07 Sudhir Kumar <[EMAIL PROTECTED]> Created this test #
#
#
#################################################################################
Index:
ltp-full-20080229/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
===================================================================
---
ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
+++
ltp-full-20080229/testcases/kernel/controllers/cpuctl/run_cpuctl_stress_test.sh
@@ -37,13 +37,13 @@
# Precaution: Avoid system use by other applications/users to get fair and
#
# appropriate results
#
#
#
-# Author: Sudhir Kumar <[EMAIL PROTECTED]> #
+# Author: Sudhir Kumar <[EMAIL PROTECTED]> #
#
#
# History:
#
#
#
-# DATE NAME EMAIL DESC
#
+# DATE NAME EMAIL DESC
#
#
#
-# 20/12/07 Sudhir Kumar <[EMAIL PROTECTED]> Created this test #
+# 20/12/07 Sudhir Kumar <[EMAIL PROTECTED]> Created this test #
#
#
#################################################################################
Index: ltp-full-20080229/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
===================================================================
---
ltp-full-20080229.orig/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
+++ ltp-full-20080229/testcases/kernel/controllers/cpuctl/run_cpuctl_test.sh
@@ -24,8 +24,8 @@
# 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 01: Tests fairness with respect to absolute share values
#
+# Test 02: Tests if fairness persists among different runs
#
# Test 03: Granularity test with respect to shares values
#
# Test 04: Nice value effect on group scheduling
#
# Test 05: Task migration test
#
@@ -33,13 +33,13 @@
# Precaution: Avoid system use by other applications/users to get fair and
#
# appropriate results
#
#
#
-# Author: Sudhir Kumar <[EMAIL PROTECTED]> #
+# Author: Sudhir Kumar <[EMAIL PROTECTED]> #
#
#
# History:
#
#
#
-# DATE NAME EMAIL DESC
#
+# DATE NAME EMAIL DESC
#
#
#
-# 20/12/07 Sudhir Kumar <[EMAIL PROTECTED]> Created this test #
+# 20/12/07 Sudhir Kumar <[EMAIL PROTECTED]> Created this test #
#
#
#################################################################################
@@ -144,7 +144,7 @@ NUM_CPUS=`cat /proc/cpuinfo | grep -w pr
TASK_NUM=`expr $TASK_NUM + 1`;
cp cpuctl_test02 cpuctl_task_$TASK_NUM 2>/dev/null;
chmod +x cpuctl_task_$TASK_NUM;
- if [ $i -eq 1 ] # Renice 1 task in each group
+ if [ $i -eq 1 ] # Renice all tasks of group 1
then
NICELEVEL=$NICEVALUE;
else
Index:
ltp-full-20080229/testcases/kernel/controllers/libcontrollers/libcontrollers.c
===================================================================
---
ltp-full-20080229.orig/testcases/kernel/controllers/libcontrollers/libcontrollers.c
+++
ltp-full-20080229/testcases/kernel/controllers/libcontrollers/libcontrollers.c
@@ -1,3 +1,38 @@
+/******************************************************************************/
+/*
*/
+/* 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
*/
+/*
*/
+/******************************************************************************/
+
+/******************************************************************************/
+/*
*/
+/* File: libcontrollers.c
*/
+/*
*/
+/* Description: This file contains the definitions for the functions/apis
*/
+/* for the controllers library. This library is used by the
*/
+/* controllers testcases.
*/
+/*
*/
+/* Author: Sudhir Kumar [EMAIL PROTECTED] */
+/*
*/
+/* History:
*/
+/* Created- 15/02/2008 -Sudhir Kumar <[EMAIL PROTECTED]> */
+/*
*/
+/******************************************************************************/
+
#include "libcontrollers.h"
/*
@@ -108,7 +143,7 @@ int read_file(char *filepath, int action
}
/*
- * Function: errir_function()
+ * Function: error_function()
* Prints error message and returns -1
*/
Index:
ltp-full-20080229/testcases/kernel/controllers/libcontrollers/libcontrollers.h
===================================================================
---
ltp-full-20080229.orig/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++
ltp-full-20080229/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -1,3 +1,38 @@
+/******************************************************************************/
+/*
*/
+/* 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
*/
+/*
*/
+/******************************************************************************/
+
+/******************************************************************************/
+/*
*/
+/* File: libcontrollers.h
*/
+/*
*/
+/* Description: This file contains the declarations for the functions and
*/
+/* variables used by the library and the test files.
*/
+/*
*/
+/* Author: Sudhir Kumar [EMAIL PROTECTED] */
+/*
*/
+/* History:
*/
+/* Created- 15/02/2008 -Sudhir Kumar <[EMAIL PROTECTED]> */
+/*
*/
+/******************************************************************************/
+
+/* Standard Include Files */
#include <dirent.h>
#include <limits.h>
#include <stdio.h>
@@ -45,3 +80,5 @@ int scan_shares_files ();
int write_to_file (char * file, const char* mode, unsigned int value);
void signal_handler_alarm (int signal );
+
+void signal_handler_sigusr2 (int signal);
Index: ltp-full-20080229/testcases/kernel/controllers/testplan.txt
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/testplan.txt
+++ ltp-full-20080229/testcases/kernel/controllers/testplan.txt
@@ -10,15 +10,5 @@ cases.
A brief description of all the testcases is given in the corresponding
controllers directory.
-CPU CONTROLLER:
-==============
-
-Test 01:
-
-The aim of the test is to find any dependency of cpu controller on exact value
-of shares to schedule the tasks. For example if there are two groups running
-1 task each then they must get the cpu time in the same ratio irrespective of
-the share values i.e. share ratios 1:2, 10:20, 100:200, 1000:2000 etc should
-give the same cpu usage for each group.
-
-For more information on resource controllers please refer to cgroups.txt in
kernel documentation.
+For more information on resource controllers please refer to cgroups.txt in
+kernel source code documentation.
Index: ltp-full-20080229/testcases/kernel/controllers/test_controllers.sh
===================================================================
--- ltp-full-20080229.orig/testcases/kernel/controllers/test_controllers.sh
+++ ltp-full-20080229/testcases/kernel/controllers/test_controllers.sh
@@ -51,7 +51,7 @@ then
else
echo "CONTROLLERS TESTCASES: WARNING";
echo "Kernel does not support for cpu controller";
- echo "Skipping all controllers testcases....";
+ echo "Skipping all cpu controller testcases....";
fi
else
echo "CONTROLLERS TESTCASES: WARNING"
Regards
Sudhir
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list