summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:15:25 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:15:25 +0000
commit97899c377dce7a4b9c655e1e5dcbb49a90525e31 (patch)
treee615c7a64a847516864f55171f5bac484b14f0b4
parent3c92b2b795c153540fea315427b2fd60bc947541 (diff)
downloadlibcg-97899c377dce7a4b9c655e1e5dcbb49a90525e31.tar.gz
libcg-97899c377dce7a4b9c655e1e5dcbb49a90525e31.tar.xz
libcg-97899c377dce7a4b9c655e1e5dcbb49a90525e31.zip
libcgroup Test: libcgroup-attach_task-test-for-cmmongrp-multimnt
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
-rw-r--r--tests/libcgrouptest01.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c
index 5eac509..a6f2339 100644
--- a/tests/libcgrouptest01.c
+++ b/tests/libcgrouptest01.c
@@ -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);