summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:20:36 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:20:36 +0000
commit44f5dae655206be2040c2f927c6accb5e897555f (patch)
tree4c6cef0ad35782411d1c99eacf0a0af3b3c38077
parentd55d78c9dfe5e6fbc499bf532bcf4859be59d326 (diff)
downloadlibcg-44f5dae655206be2040c2f927c6accb5e897555f.tar.gz
libcg-44f5dae655206be2040c2f927c6accb5e897555f.tar.xz
libcg-44f5dae655206be2040c2f927c6accb5e897555f.zip
libcgroup Test: fix-modify_cgroup-bug-in-multimnt
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
-rw-r--r--tests/libcgrouptest01.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c
index 2481395..333957b 100644
--- a/tests/libcgrouptest01.c
+++ b/tests/libcgrouptest01.c
@@ -20,6 +20,7 @@ int main(int argc, char *argv[])
{
int fs_mounted, retval;
struct cgroup *cgroup1, *cgroup2, *cgroup3, *nullcgroup = NULL;
+ struct cgroup_controller *sec_controller;
/* In case of multimount for readability we use the controller name
* before the cgroup structure name */
struct cgroup *ctl1_cgroup1, *ctl2_cgroup1, *ctl2_cgroup2;
@@ -825,14 +826,24 @@ int main(int argc, char *argv[])
" Exiting without running further testcases\n");
exit(1);
}
- if (!cgroup_add_controller(mod_common_cgroup, controller_name))
+
+ sec_controller = cgroup_add_controller(mod_common_cgroup,
+ controller_name);
+ if (!sec_controller) {
message(++i, FAIL, "add_controller()", retval, extra);
+ printf("The cgroup_modify_cgroup() test will fail\n");
+ }
+
+ strncpy(val_string, "7000000", sizeof(val_string));
+ retval = cgroup_add_value_string(sec_controller,
+ control_file, val_string);
+ if (retval)
+ printf("The cgroup_modify_cgroup() test will fail\n");
/*
* Test14: modify existing cgroup with this new cgroup
* Exp outcome: zero return value and control value modified
*/
-
strncpy(extra, " Called with commongroup. ", SIZE);
retval = cgroup_modify_cgroup(mod_common_cgroup);
/* Check if the values are changed */
@@ -840,11 +851,14 @@ int main(int argc, char *argv[])
set_controller(ctl1, controller_name, control_file);
build_path(path_control_file, mountpoint,
"commongroup", control_file);
+ strncpy(val_string, "260000", sizeof(val_string));
if (!group_modified(path_control_file, STRING)) {
set_controller(ctl2, controller_name,
control_file);
build_path(path_control_file, mountpoint2,
"commongroup", control_file);
+ strncpy(val_string, "7000000",
+ sizeof(val_string));
if (!group_modified(path_control_file, STRING)) {
strncat(extra, " group modified under"
" both controllers\n", SIZE);