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

tests/libcgrouptest01.c

index 5eac509903d37935a0db28ed43f1e1795b9a6f63..a6f233948d5858b89c4fb973c9f67da085b5b1ff 100644 (file)
@@ -833,7 +833,38 @@ int main(int argc, char *argv[])
                strncpy(extra, "\n", SIZE);
 
                /*
-                * Test12: delete this common cgroup
+                * Test12: Call cgroup_attach_task() with this common group
+                * and check if return values are correct. If yes check if
+                * task exists in the group under both controller's hierarchy
+                */
+               strncpy(extra, " Called with commongroup. ", SIZE);
+               retval = cgroup_attach_task(common_cgroup);
+               if (retval == 0) {
+                       /*Task already attached to ctl1 in previous call*/
+                       build_path(tasksfile, mountpoint,
+                                                "commongroup", "tasks");
+                       build_path(tasksfile2, mountpoint2,
+                                                "commongroup", "tasks");
+
+                       if (check_task(tasksfile) && check_task(tasksfile2)) {
+                               strncat(extra, " Task found in grps\n", SIZE);
+                               message(++i, PASS, "attach_task()",
+                                                                retval, extra);
+                       } else {
+                               strncat(extra, " Task not found in grps\n",
+                                                                        SIZE);
+                               message(++i, FAIL, "attach_task()", retval,
+                                                                        extra);
+                       }
+               } else {
+                       strncat(extra, "\n", sizeof("\n"));
+                       message(++i, FAIL, "attach_task()", retval, extra);
+               }
+
+               strncpy(extra, "\n", SIZE);
+
+               /*
+                * Test13: delete this common cgroup
                 * Exp outcome: zero return value
                 */
                strncpy(extra, " Called with commongroup. ", SIZE);