summaryrefslogtreecommitdiffstats
path: root/tests/libcgrouptest.h
Commit message (Collapse)AuthorAgeFilesLines
* libcgrouptest: Change the dynamic creation of messages to static 2d arrayDhaval Giani2008-12-301-7/+2
| | | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This is addressing all the comments on the list and others too. Earlier we were creating the messgae array dynamicaly which is not required as the messages do not change dynamicaly. Let us have a static 2D array of messages. This patch does that. (This addresses the comment on the list ;)) Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@295 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: test for cgroup_add/free_controllerDhaval Giani2008-12-221-0/+1
| | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch adds testcases for cgroup_add_controller() wrapper api. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@292 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: test for cgroup_get_cgroupDhaval Giani2008-12-221-1/+1
| | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch adds one testcase for cgroup_get_cgroup() api. The test creates a group in filesystem, reads it in another cgroup and compares the two and throws the results. Also bounds the execution of certain basic testcases for the same api under single mount only, as not required under multimnt. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@291 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: replace numbers by meaningful macrosDhaval Giani2008-12-221-0/+22
| | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch replaces the magic numbers from the info messages with the corresponding meaningful enums. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@289 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: create function for cgroup_modify_cgroupDhaval Giani2008-12-221-1/+3
| | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch creates the function test_cgroup_modify_cgroup(), to modify a group in fs, and this way eliminates lot of redundant code. This patch however may mesh up the numbering of testcases, which will be cleaned up in a later patch. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@288 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: create function for cgroup_delete_cgroupDhaval Giani2008-12-221-0/+2
| | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch creates the function test_cgroup_delete_cgroup(), to delete a group in fs, and this way eliminates lot of redundant code. This patch however may mesh up the numbering of testcases, which will be cleaned up in a later patch once the functions are created for all other apis too. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@287 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: create function for cgroup_create_cgroupDhaval Giani2008-12-221-0/+2
| | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch creates the function test_cgroup_create_cgroup(), to create a group in fs from a cgroup structure, and this way eliminates lot of redundant code. This patch however may mesh up the numbering of testcases, which will be cleaned up in a later patch once the functions are created for all other apis. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@286 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: cleanup: remove redundant parameter to functionDhaval Giani2008-12-221-2/+4
| | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> There is no need to pass a separate variable for getting single/multiple mount info, as we can get this info from the varaible received from script. So this patch does that modification and puts the variaable fs_mounted as global as it is never modified. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@284 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: create function for cgroup_new_cgroupDhaval Giani2008-12-221-1/+3
| | | | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch creates the function create_new_cgroup_ds(), to create a well populated cgroup structure, and this way eliminates lot of redundant code. This function internaly call other functions to provide a complete cgroup structure. This patch breaks one of the testcases because of the global data being used. I have fixed that in the dame patch to maintain uniformity as this is a single line fix only and is well commented in the code. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@283 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: libcgroup testcases for cgroup_get_cgroupDhaval Giani2008-12-221-0/+1
| | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This atch adds a new testcase for api cgroup_get_cgroup() for single mount case. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@282 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: libcgroup testcases for compare_cgroupDhaval Giani2008-12-221-0/+1
| | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch adds a testcase for cgroup_compare_cgroup() wrapper. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@281 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: add messageBalbir Singh2008-12-171-1/+1
| | | | | | | | | | This patch fixes the NUM_MSGS error which was still 10, however there are more type of messages to be printed. It also adds the support to just print a new line in case there is no message to be printed. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@279 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: suppress-string-constant-warnings-in-compilationBalbir Singh2008-12-171-4/+6
| | | | | | | | The following patch removes the string to char * conversion warnings. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@276 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-split-new-cgroup-functionBalbir Singh2008-12-171-0/+2
| | | | | | | | | This patch splits the earlier created function new_cgroup() into two to make it more useful for other testcases. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@274 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgrouptest-fix-cntlr-order-error-in-scriptBalbir Singh2008-12-171-1/+1
| | | | | | | | | Sometimes on some machines, encounterd an issue of getting the controllers information in reverse order. So keeping the uniformity for future. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@273 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-create-function-for-attach_task-apiBalbir Singh2008-12-171-0/+5
| | | | | | | | | | | | | | This patch creates a function test_cgroup_attach_task() to test the libcgroup api cgroup_attach_task() under different scenario. In the earlier approach we were not usong functions and were testing the api sequentialy under different conditions. The new approach has a single function for 1 api which can handle the testing under all conditions. The advantage is that the test case becomes thread safe as all the variables are now declared on stack. The other benefit is that the code repetition has reduced now. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@268 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-create-function-for-init-apiBalbir Singh2008-12-171-0/+4
| | | | | | | | | | | | This patch creates a function test_cgroup_init() to test the libcgroup api cgroup_init() under different scenario. In the earlier approach we were not usong functions and were testing the api sequentialy under different conditions. The new approach has a single function for 1 api which can handle the testing under all conditions. The advantage is that the code repetition has reduced now. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@267 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-add-static-array-for-testcase-info-messagesBalbir Singh2008-12-171-0/+9
| | | | | | | | | | | | This patch removes all the strncpy() calls that were made before each api call to print the info messages. This patch creates an array of such info messages, initialize them, and then frees them with the help of two functions set_info_msgs(), called at start and free_info_msgs() called at end. The main motto has been to avoid the global variables due to thread safety reasons. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@266 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: make-controller-use-generic-in-binaryBalbir Singh2008-12-171-0/+1
| | | | | | | | | | | | | | | | | | This patch makes the use of controllers available from script more generic. All possible controllers in Linux kernel are to be kept as enum parameters and a corresponding mapping is done in both, the script and binary. The testcases are no more hardcoded with respect to controllers. The function set_controller() need to be updated with respect to the controllers and control file. The challenges yet to be solved are: (1)Choosing appropriate control file (2)Choosing appropriate control value dynamicaly. Thoughts are most welcome. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@259 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: put-commoncode-in-build-path-functionBalbir Singh2008-12-171-0/+2
| | | | | | | | | This patch puts the common code into a function build_path() and thus reduces lots of redundant lines of code. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@257 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: cleanup1Balbir Singh2008-12-171-0/+9
| | | | | | | | | | Hi, This patch does cleanup in first set of testcases. It defines a new function to print test results. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@248 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgrouptest-multimnt-sanitycheckBalbir Singh2008-12-171-1/+1
| | | | | | | | | | | Hi The following patch adds the sanity check in c file for multiple mount case. The parameter passed to the function decides whether the check is for single mount or multiple mount. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@246 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgrouptest-multimnt01Balbir Singh2008-12-171-0/+1
| | | | | | | | | | | | | This patch adds a testcase for libcgroup API cgroup_attach_task() testing. The API is called under the multimount condition(FS_MOUNTED=2) and return values are checked. The task pid is checked if it exists under the root group's tasks file of both the mountpoints. The patch also puts the common code in a function. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@241 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <skumar@linux.vnet.ibm.com>Dhaval Giani2008-07-011-0/+2
| | | | | | | | | | | | | | libcgroup: adds sanity check in libcgroup testcases binary This patch adds a sanity check on cgroup file system info in testcases. If cgroup filesystem is not mounted and script sends the info as mounted, then the binar would have failed. This patch handles that. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@95 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <skumar@linux.vnet.ibm.com>Dhaval Giani2008-07-011-1/+9
| | | | | | | | | | | | | | | libcgroup: put common code in a function This patch puts the common code for creating cgroup structure into a function struct cgroup *new_cgroup(). The function uses few global variables which are changed before the function call and takes few variables as arguments. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@93 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <skumar@linux.vnet.ibm.com>Dhaval Giani2008-07-011-0/+14
| | | | | | | | | | | | | | | | | libcgroup: testcases for wrapper api and cgroup_modify_cgroup() This patch creates a valid cgroup structure to be passed as the parameter for cgroup_modify_cgroup() function and calls this function. The return values are checked and on that basis the test is declared as pass or fail. The patch adds the code that check if the parameter changed reflect in the filesystem. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@92 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <skumar@linux.vnet.ibm.com>Dhaval Giani2008-07-011-0/+15
| | | | | | | | | | | | | | | | | libcgroup: libcgroup testcases for cgroup_attach_task() This patch adds testcases for libcgroup API cgroup_create_cgroup() and cgroup_delete_cgroup() testing. The APIs are called under the same but two conditions(FS_MOUNTED=0/1) and return values are checked. The cgroup is created and freed using the wrapper APIs. Testcases for FS_MOUNTED=2 have to be added. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@90 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* From: Sudhir Kumar <skumar@linux.vnet.ibm.com>Dhaval Giani2008-07-011-0/+38
libcgroup: framework for libcgroup testcases This Patch creates the basic infrastructure for libcgroup testcases. This patch adds a script which runs the binary(C) file. The script does all the environment setup to run the tests and passes this info to the C file through command line arguments. The binary runs the test cases calling the API's in different environment conditions. The Makefile compiles the test. The top level Makefile.in is edited to support make test make testclean The script runs this binary total 3 times, each time with diff varaible. FS_MOUNTED=0 # cgroup fs not mounted FS_MOUNTED=1 # cgroup fs mounted FS_MOUNTED=2 # cgroup fs mounted at multiple points Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@87 4f4bb910-9a46-0410-90c8-c897d4f1cd53