summaryrefslogtreecommitdiffstats
path: root/tests/libcgrouptest01.c
Commit message (Collapse)AuthorAgeFilesLines
* libcgroup test: Change dbg to cgroup_dbgDhaval Giani2009-02-271-4/+5
| | | | | | | | | | | | | | Since cgroup_dbg is defined on the basis of CGROUP_DBG, we get libcgrouptest.h and libcg_ba.cpp to include config.h and change dbg to cgroup_dbg. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@354 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest: rename get_controller() to is_subsystem_enabled()Dhaval Giani2009-01-141-2/+2
| | | | | | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch renames the function get_controllers() to a more meaningful name is_subsystem_enabled(). history: The code in the patch is part of a patch sent in an earlier patchset, which somehow got dropped (looks an older version of that patch was merged to the tree). Adding this patch makes everything upstream upto the discussion held on the list. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Acked-by: Dhaval Giani <dhaval@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@314 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest:attach exclusive pid support in test_cgroup_attach_task() functionDhaval Giani2009-01-091-10/+11
| | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> The function test_attach_task_pid() was attaching the process calling the function to a group and did not have support to take any pid for attaching it to a group. This patch does that. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Acked-by: Dhaval Giani <dhaval@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@310 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest: Move functions into a new file to reuseDhaval Giani2009-01-091-730/+0
| | | | | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> There were some coding style warnings that have been fixed in this patch. Basicaly the ones reported by checkpatch.pl This patch puts the test functions in a separate file so that they can be reused for further testing. Some of the functions were static and hence changed to be non static. It also edits the Makefile so that the patch compiles. 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@309 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest: Avoid external variables usageDhaval Giani2009-01-091-72/+107
| | | | | | | | | | | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> A lack of proper initial thought let me use some variables globaly, which is not a good idea at all. However fixing this issue at this stage is not very good from the point that it changes variables for a lot of functions. But still it has to be done for a better and reusable code. This patch does that while putting related variables in meaningful structs. Thanks to Balbir for a good suggestion. TODO: Fill these data structures from a configuration file after analyzing requirements from different test functions. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@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@307 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest: Cleanup valgrind output for libcgroup testsDhaval Giani2009-01-051-17/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a few memory leaks, and leaked file handles. [root@gondor tests]# make g++ -g -O2 -Wall -DDEBUG -I .. -o libcgrouptest01 libcgrouptest01.c -L .. -lcgroup -lpthread libcgrouptest01.c: In function ‘int group_modified(char*, int)’: libcgrouptest01.c:1060: warning: format ‘%d’ expects type ‘int*’, but argument 3 has type ‘bool*’ s[root@gondor tests]# sh runlibcgrouptest.sh Running first set of testcases ============================== ==14758== Memcheck, a memory error detector. ==14758== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==14758== Using LibVEX rev 1804, a library for dynamic binary translation. ==14758== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==14758== Using valgrind-3.3.0, a dynamic binary instrumentation framework. ==14758== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==14758== For more details, rerun with: -v ==14758== C:DBG: fs_mounted as recieved from script=0 TEST 1:PASS : cgroup_init() Ret Value = 50001 TEST 2:PASS : cgroup_attach_task() Ret Value = 50014 Parameter nullcgroup TEST 3:PASS : cgroup_new_cgroup() Ret Value = 0 TEST 4:PASS : cgroup_create_cgroup() Ret Value = 50014 TEST 5:PASS : cgroup_delete_cgroup() Ret Value = 50014 TEST 6:PASS : cgroup_create_cgroup() Ret Value = 50014 TEST 7:PASS : cgroup_delete_cgroup() Ret Value = 50014 TEST 8:PASS : cgroup_add_controller() Ret Value = 0 TEST 9:PASS : cgroup_add_controller() Ret Value = 0 TEST10:PASS : cgroup_add_controller() Ret Value = 0 ==14758== ==14758== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 1) ==14758== malloc/free: in use at exit: 0 bytes in 0 blocks. ==14758== malloc/free: 18 allocs, 18 frees, 32,293 bytes allocated. ==14758== For counts of detected errors, rerun with: -v ==14758== All heap blocks were freed -- no leaks are possible. Running second set of testcases ============================== ==14774== Memcheck, a memory error detector. ==14774== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==14774== Using LibVEX rev 1804, a library for dynamic binary translation. ==14774== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==14774== Using valgrind-3.3.0, a dynamic binary instrumentation framework. ==14774== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==14774== For more details, rerun with: -v ==14774== C:DBG: fs_mounted as recieved from script=1 C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1 sanity check pass. cgroup TEST 1:PASS : cgroup_attach_task() Ret Value = 50014 Parameter nullcgroup TEST 2:PASS : cgroup_init() Ret Value = 0 TEST 3:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s TEST 4:PASS : cgroup_attach_task_pid() Ret Value = 50016 TEST 5:PASS : cgroup_new_cgroup() Ret Value = 0 TEST 6:PASS : cgroup_create_cgroup() Ret Value = 0 group found in filesystem TEST 7:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x40070D8: strncat (mc_replace_strmem.c:214) ==14774== by 0x804BC92: main (libcgrouptest01.c:1271) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007271: strcpy (mc_replace_strmem.c:268) ==14774== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14774== by 0x804BC9D: main (libcgrouptest01.c:252) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007285: strcpy (mc_replace_strmem.c:268) ==14774== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14774== by 0x804BC9D: main (libcgrouptest01.c:252) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x8049471: _ZL14group_modifiedPci (libcgrouptest01.c:1076) ==14774== by 0x804C583: main (libcgrouptest01.c:254) ==14774== ==14774== by 0x804C583: main (libcgrouptest01.c:254) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x8049479: _ZL14group_modifiedPci (libcgrouptest01.c:1076) ==14774== by 0x804C583: main (libcgrouptest01.c:254) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007470: strncmp (mc_replace_strmem.c:314) ==14774== by 0x804949B: _ZL14group_modifiedPci (libcgrouptest01.c:1076) ==14774== by 0x804C583: main (libcgrouptest01.c:254) TEST 8:PASS : cgroup_modify_cgroup() Ret Value = 0 Parameter same cgroup TEST 9:PASS : cgroup_new_cgroup() Ret Value = 0 ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007271: strcpy (mc_replace_strmem.c:268) ==14774== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14774== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14774== by 0x804BD35: main (libcgrouptest01.c:286) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007285: strcpy (mc_replace_strmem.c:268) ==14774== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14774== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14774== by 0x804BD35: main (libcgrouptest01.c:286) TEST10:PASS : cgroup_modify_cgroup() Ret Value = 0 TEST11:PASS : cgroup_modify_cgroup() Ret Value = 50007 TEST12:PASS : cgroup_new_cgroup() Ret Value = 0 ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007271: strcpy (mc_replace_strmem.c:268) ==14774== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14774== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14774== by 0x804BDF3: main (libcgrouptest01.c:314) ==14774== ==14774== Conditional jump or move depends on uninitialised value(s) ==14774== at 0x4007285: strcpy (mc_replace_strmem.c:268) ==14774== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14774== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14774== by 0x804BDF3: main (libcgrouptest01.c:314) TEST13:PASS : cgroup_modify_cgroup() Ret Value = 0 TEST14:PASS : cgroup_get_cgroup() Ret Value = 50007 Parameter nullcgroup TEST15:PASS : cgroup_get_cgroup() Ret Value = 50002 Parameter not created group TEST16:PASS : cgroup_get_cgroup() Ret Value = 0 TEST 0:PASS : cgroup_new_cgroup() Ret Value = 0 TEST 0:PASS : cgroup_create_cgroup() Ret Value = 0 group found in filesystem TEST17:FAIL : cgroup_get_cgroup() Ret Value = 50017 TEST16:PASS : cgroup_delete_cgroup() Ret Value = 0 Group deleted from filesystem TEST17:PASS : cgroup_create_cgroup() Ret Value = 50007 TEST18:PASS : cgroup_delete_cgroup() Ret Value = 50007 TEST19:PASS : cgroup_compare_cgroup() Ret Value = 50011 Parameter nullcgroup TEST20:PASS : cgroup_compare_cgroup() Ret Value = 0 TEST21:PASS : cgroup_compare_cgroup() Ret Value = 50017 ==14774== ==14774== ERROR SUMMARY: 45 errors from 10 contexts (suppressed: 18 from 1) ==14774== malloc/free: in use at exit: 0 bytes in 0 blocks. ==14774== malloc/free: 187 allocs, 187 frees, 234,711 bytes allocated. ==14774== For counts of detected errors, rerun with: -v ==14774== All heap blocks were freed -- no leaks are possible. Cleanup done Running third set of testcases ============================== ==14827== Memcheck, a memory error detector. ==14827== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==14827== Using LibVEX rev 1804, a library for dynamic binary translation. ==14827== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==14827== Using valgrind-3.3.0, a dynamic binary instrumentation framework. ==14827== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==14827== For more details, rerun with: -v ==14827== C:DBG: fs_mounted as recieved from script=2 C:DBG: mountpoint1 as recieved from script=/dev/cgroup_controllers-1 C:DBG: mountpoint2 as recieved from script=/dev/cgroup_controllers-2 sanity check pass. cgroup TEST 1:PASS : cgroup_init() Ret Value = 0 TEST 2:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s TEST 1:PASS : cgroup_init() Ret Value = 0 TEST 2:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s TEST 3:PASS : cgroup_new_cgroup() Ret Value = 0 TEST 4:PASS : cgroup_create_cgroup() Ret Value = 0 group found in filesystem TEST 5:PASS : cgroup_new_cgroup() Ret Value = 0 TEST 6:PASS : cgroup_create_cgroup() Ret Value = 0 group found in filesystem TEST 7:PASS : cgroup_create_cgroup() Ret Value = 0 group found in filesystem TEST 8:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s TEST 9:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s TEST10:PASS : cgroup_new_cgroup() Ret Value = 0 TEST11:PASS : cgroup_attach_task() Ret Value = 50002 Parameter not created group TEST12:PASS : cgroup_new_cgroup() Ret Value = 0 ==14827== Conditional jump or move depends on uninitialised value(s) ==14827== at 0x4007271: strcpy (mc_replace_strmem.c:268) ==14827== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14827== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14827== by 0x804C1D6: main (libcgrouptest01.c:498) TEST13:PASS : cgroup_modify_cgroup() Ret Value = 0 TEST14:PASS : cgroup_new_cgroup() Ret Value = 0 ==14827== ==14827== Conditional jump or move depends on uninitialised value(s) ==14827== at 0x4007271: strcpy (mc_replace_strmem.c:268) ==14827== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14827== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14827== by 0x804C23C: main (libcgrouptest01.c:519) ==14827== ==14827== Conditional jump or move depends on uninitialised value(s) ==14827== at 0x4007285: strcpy (mc_replace_strmem.c:268) ==14827== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14827== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14827== by 0x804C23C: main (libcgrouptest01.c:519) TEST15:PASS : cgroup_modify_cgroup() Ret Value = 0 TEST16:PASS : cgroup_delete_cgroup() Ret Value = 0 Group deleted from filesystem TEST17:PASS : cgroup_delete_cgroup() Ret Value = 0 Group deleted from filesystem TEST18:PASS : cgroup_new_cgroup() Ret Value = 0 TEST19:PASS : cgroup_create_cgroup() Ret Value = 0 group found under both controllers TEST20:PASS : cgroup_attach_task() Ret Value = 0 Task found in group/s TEST21:PASS : cgroup_new_cgroup() Ret Value = 0 ==14827== ==14827== Conditional jump or move depends on uninitialised value(s) ==14827== at 0x4007271: strcpy (mc_replace_strmem.c:268) ==14827== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14827== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14827== by 0x804C464: main (libcgrouptest01.c:622) ==14827== ==14827== Conditional jump or move depends on uninitialised value(s) ==14827== at 0x4007285: strcpy (mc_replace_strmem.c:268) ==14827== by 0x402F24B: cgroup_modify_cgroup (api.c:1012) ==14827== by 0x804A3E7: test_cgroup_modify_cgroup(int, cgroup*, char const*, int, int, int, int, int) (libcgrouptest01.c:889) ==14827== by 0x804C464: main (libcgrouptest01.c:622) TEST22:PASS : cgroup_modify_cgroup() Ret Value = 0 group modified under both controllers TEST23:PASS : cgroup_delete_cgroup() Ret Value = 0 Group deleted from filesystem TEST 0:PASS : cgroup_new_cgroup() Ret Value = 0 TEST 0:PASS : cgroup_create_cgroup() Ret Value = 0 group found in filesystem TEST24:FAIL : cgroup_get_cgroup() Ret Value = 50018 ==14827== ==14827== ERROR SUMMARY: 79 errors from 5 contexts (suppressed: 18 from 1) ==14827== malloc/free: in use at exit: 66,044 bytes in 15 blocks. ==14827== malloc/free: 196 allocs, 181 frees, 228,734 bytes allocated. ==14827== For counts of detected errors, rerun with: -v ==14827== searching for pointers to 15 not-freed blocks. ==14827== checked 6,381,180 bytes. ==14827== ==14827== ==14827== 66,044 (18,064 direct, 47,980 indirect) bytes in 4 blocks are definitely lost in loss record 1 of 3 ==14827== at 0x4004BA2: calloc (vg_replace_malloc.c:397) ==14827== by 0x4030D9A: cgroup_new_cgroup (wrapper.c:28) ==14827== by 0x8049656: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1132) ==14827== by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744) ==14827== by 0x804C190: main (libcgrouptest01.c:485) ==14827== ==14827== ==14827== 20,980 bytes in 5 blocks are indirectly lost in loss record 2 of 3 ==14827== at 0x4004BA2: calloc (vg_replace_malloc.c:397) ==14827== by 0x4030C2C: cgroup_add_value_string (wrapper.c:122) ==14827== by 0x8048FDB: _ZL17add_control_valueP17cgroup_controllerPcS1_i (libcgrouptest01.c:1113) ==14827== by 0x4030C2C: cgroup_add_value_string (wrapper.c:122) ==14827== by 0x8048FDB: _ZL17add_control_valueP17cgroup_controllerPcS1_i (libcgrouptest01.c:1113) ==14827== by 0x80496C9: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1147) ==14827== by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744) ==14827== by 0x804C190: main (libcgrouptest01.c:485) ==14827== ==14827== ==14827== 27,000 bytes in 6 blocks are indirectly lost in loss record 3 of 3 ==14827== at 0x4004BA2: calloc (vg_replace_malloc.c:397) ==14827== by 0x4030F4B: cgroup_add_controller (wrapper.c:62) ==14827== by 0x80496AE: new_cgroup(char*, char*, char*, int, int) (libcgrouptest01.c:1144) ==14827== by 0x8049917: create_new_cgroup_ds(int, char const*, int, int) (libcgrouptest01.c:744) ==14827== by 0x804C190: main (libcgrouptest01.c:485) ==14827== ==14827== LEAK SUMMARY: ==14827== definitely lost: 18,064 bytes in 4 blocks. ==14827== indirectly lost: 47,980 bytes in 11 blocks. ==14827== possibly lost: 0 bytes in 0 blocks. ==14827== still reachable: 0 bytes in 0 blocks. ==14827== suppressed: 0 bytes in 0 blocks. Cleanup done [root@gondor tests]# Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@300 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest: Initialize uninitialized pointers in test casesDhaval Giani2009-01-021-2/+2
| | | | | | | | | | | | | | | | Pointers should be initialized to NULL. In the multi mount test case path, we had an uninitialized cgroup_filled which caused a segmentation fault. Fix it for this test case. TODO: Fix for all test cases. Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> Cc: Sudhir Kumar <skumar@linux.vnet.ibm.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@297 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgrouptest: Change the dynamic creation of messages to static 2d arrayDhaval Giani2008-12-301-117/+24
| | | | | | | | | | | | | | | | | | 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/+32
| | | | | | | | | | | | | 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-27/+75
| | | | | | | | | | | | | | | | | 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: one more test for cgroup_get_cgroupDhaval Giani2008-12-221-0/+11
| | | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> The following patch adds a scenario for testing cgroup_get_cgroup() api. The test is called with a cgroup which has not been created yet. 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@290 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: replace numbers by meaningful macrosDhaval Giani2008-12-221-72/+92
| | | | | | | | | | | | | | 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-99/+116
| | | | | | | | | | | | | | | 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-122/+70
| | | | | | | | | | | | | | | | 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-125/+74
| | | | | | | | | | | | | | | | | 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: adds warning messages in libcgroup testcasesDhaval Giani2008-12-221-9/+15
| | | | | | | | | | | | From: Sudhir Kumar <skumar@linux.vnet.ibm.com> This patch adds few more warning messages in the message pool 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@285 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup: cleanup: remove redundant parameter to functionDhaval Giani2008-12-221-14/+12
| | | | | | | | | | | | | | | | 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-134/+142
| | | | | | | | | | | | | | | | | | | 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-1/+37
| | | | | | | | | | | | | | 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/+68
| | | | | | | | | | | | | | 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:Balbir Singh2008-12-171-6/+6
| | | | | | | | Minor cleanups. Signed-off-by: Sudhir KUmar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@280 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: add messageBalbir Singh2008-12-171-0/+3
| | | | | | | | | | 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: change control valueBalbir Singh2008-12-171-3/+3
| | | | | | | | | | This patch changes the control values to be written to control file. The write of value 7000000 to memory.limt_in_bytes resulted in a silent write of 7000064, because of which modify() test case was failing. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@278 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: address earlier commentsBalbir Singh2008-12-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch addresses the comments on testcases sent earlier. Some of the corrections have been made in the coming patches which create functions to test an api under different scenarios. The simple reason behind that is to avoid the patches that contain only noise. For ex const strn* warnings. I got one of the comments from Balbir Singh "I wonder if we should also verify the cgroup_modify_cgroup() changes by reading back the values using cgroup_get_cgroup()" I have not used this approach for now because of two reasons(however it would have made life easy for me :)) 1. In case cgroup_get_cgroup() fails, cgroup_modify_cgroup() test also will fail. 2. If cgroup_get_cgroup() becomes deprecated or dropped, then the testcase will become obsolete. However I am still open to the idea. Your thoughts again?? Second comment was "Each test case needs to be an induvidual function (can be called from threads or other processes via a library interface)" And the coming patches do that. The next imp comment for me was "I'll try and find a good test case infrastructure, if one exists that can meet our needs." I am eager to see some tool like that. TODO: Removing the hard coding of control values using config file is under progress Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@277 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: suppress-string-constant-warnings-in-compilationBalbir Singh2008-12-171-9/+12
| | | | | | | | 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: change error value to be checkedBalbir Singh2008-12-171-5/+5
| | | | | | | Chanhe the error values as per the change in APIs Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@275 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-split-new-cgroup-functionBalbir Singh2008-12-171-28/+37
| | | | | | | | | 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: fix-modify_cgroup-bug-in-multimntBalbir Singh2008-12-171-2/+16
| | | | | | | | | | this patch fixes the testcase for cgroup_modify_cgroup() multi mount. The second controller was not initialised to a value, so doing that. /me learns the bad effects of using global data structure :) Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@272 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: fix-STRING-typoBalbir Singh2008-12-171-1/+1
| | | | | | | | Fixing a typo.(Bad effect of yy p :)) Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@271 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: fix-modify_cgroup-failures-by-changing-cntl-valuesBalbir Singh2008-12-171-11/+10
| | | | | | | | | | | Since the cpu.shares now has a max limit, this patch fixes all cgroup_modify_cgroup() testcases that were failing because of this issue. This is not a permanent fix, however, i will be changing the approach to use a configuration file for control values and the patch will be out soon, once the function creation part is over. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@270 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: fix-newly-broken-testBalbir Singh2008-12-171-0/+3
| | | | | | | | | | The previous patch creating the function for attach_task() breaks a test case because of global data usage. This patch fixes that. (There will be functions corresponding to each API to test all the APIs) Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@269 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-create-function-for-attach_task-apiBalbir Singh2008-12-171-147/+66
| | | | | | | | | | | | | | 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-15/+16
| | | | | | | | | | | | 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/+107
| | | | | | | | | | | | 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: libcgrouptest-fix-to-empty-extra-string-and-add-a-new-warningBalbir Singh2008-12-171-0/+4
| | | | git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@265 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-modify_cgroup-test3-for-multimntBalbir Singh2008-12-171-1/+67
| | | | | | | | | | | | | This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for commongroup (under two controllers) in multiple mount scenario. Again the challenge is to handle the control value as diff controllers put diff upper limit on control value and we pick the controller dynamicaly. So thoughts ??? Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@264 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-modify_cgroup-test2-for-multimntBalbir Singh2008-12-171-1/+33
| | | | | | | | | | | | | This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for multiple mount scenario for second controller. Again the challenge is to handle the control value as diff controllers put diff upper limit on control value and we pick the controller dynamicaly. So thoughts ??? Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@263 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-modify_cgroup-test1-for-multimntBalbir Singh2008-12-171-1/+35
| | | | | | | | | | | | | | | | This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for multiple mount scenario for first controller. The challenge is to handle the control value as diff controllers put diff upper limit on control value and we pick the controller dynamicaly. We are going to use a config file for that which will have the controller name, control file name and the control value. But not sure if there is any better approach. So thoughts ??? Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@262 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: libcgroup-attach_task-test-for-cmmongrp-multimntBalbir Singh2008-12-171-1/+32
| | | | | | | | | This patch adds a testcase for libcgroup api cgroup_attach_task() for a common group in multiple mount scenario. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@261 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: fix-typo-error-in-delete-cgroupBalbir Singh2008-12-171-5/+7
| | | | | | | | | | This patch fixes a testcase which was having some typo errors. (libcgroup api cgroup_delete_cgroup() for a common group in multiple mount scenario) Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@260 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: make-controller-use-generic-in-binaryBalbir Singh2008-12-171-68/+105
| | | | | | | | | | | | | | | | | | 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: set-another-controller-if-first-failsBalbir Singh2008-12-171-4/+13
| | | | | | | | | This patch adds a warning in case setting a controller fails and tries to set values for another controller. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@258 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: put-commoncode-in-build-path-functionBalbir Singh2008-12-171-59/+47
| | | | | | | | | 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: libcgroup-attach_task-singlemount-testcaseBalbir Singh2008-12-171-7/+34
| | | | | | | | | Hi, This patch adds a testcase for cgroup_attach_task() api for single mount. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@255 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: change test callBalbir Singh2008-12-171-15/+22
| | | | | | | | | | Hi, The api cgroup_modify_cgroup(cgroup1) had to be called before cgroup_modify_cgroup(cgroup2). This patch does that. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@254 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: add warningsBalbir Singh2008-12-171-7/+15
| | | | | | | | | | | Hi, This patch adds some warnings in case some testcses fail. When we modify a group with nullcgroup then there is no need to check if values are changed. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@253 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: cleanup4Balbir Singh2008-12-171-85/+176
| | | | | | | | | Hi, This patch does printf and other cleanups in third set of testcases. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@252 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: fixed certain rejectsBalbir Singh2008-12-171-3/+3
| | | | | | | | | | The following patch makes certain cleanups for the patchset to apply without any rejects. However the lines of code are being changed in one of the next patches. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@251 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: cleanup2Balbir Singh2008-12-171-58/+86
| | | | | | | | | Hi, This patch does printf and other cleanups in second set of testcases. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@249 4f4bb910-9a46-0410-90c8-c897d4f1cd53
* libcgroup Test: cleanup1Balbir Singh2008-12-171-22/+49
| | | | | | | | | | 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