]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup Test: libcgroup-modify_cgroup-test2-for-multimnt
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Wed, 17 Dec 2008 15:16:20 +0000 (15:16 +0000)
committerBalbir Singh <balbir@linux.vnet.ibm.com>
Wed, 17 Dec 2008 15:16:20 +0000 (15:16 +0000)
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

tests/libcgrouptest01.c

index 41041573e5b554f443f8abc2727aa9c2cfb3ee90..7b65fe495f9d27313247b3620c7b8d5a9575f3a5 100644 (file)
@@ -749,7 +749,39 @@ int main(int argc, char *argv[])
                        message(++i, FAIL, "modify_cgroup()", retval, extra);
 
                /*
-                * Test10: delete cgroups
+                * Create another valid cgroup structure with same group name
+                * to modify the existing group ctl2_group1
+                * Exp outcome: no error. 0 return value
+                */
+               strncpy(group, "ctl2_group1", sizeof(group));
+               retval = set_controller(ctl2, controller_name, control_file);
+               strncpy(val_string, "7000000", sizeof(val_string));
+
+               if (retval) {
+                       fprintf(stderr, "Setting controller failled "
+                               " Exiting without running further testcases\n");
+                       exit(1);
+               }
+
+               mod_ctl2_cgroup1 = new_cgroup(group, controller_name,
+                                                control_file, STRING);
+
+               /*
+                * Test10: modify existing cgroup with this new cgroup
+                * Exp outcome: zero return value and control value modified
+                */
+               build_path(path_control_file, mountpoint2,
+                                                "ctl2_group1", control_file);
+
+               retval = cgroup_modify_cgroup(mod_ctl2_cgroup1);
+               /* Check if the values are changed */
+               if (!retval && !group_modified(path_control_file, STRING))
+                       message(++i, PASS, "modify_cgroup()", retval, extra);
+               else
+                       message(++i, FAIL, "modify_cgroup()", retval, extra);
+
+               /*
+                * Test11: delete cgroups
                 * Exp outcome: zero return value
                 */
                retval = cgroup_delete_cgroup(ctl1_cgroup1, 1);