From 97899c377dce7a4b9c655e1e5dcbb49a90525e31 Mon Sep 17 00:00:00 2001 From: Balbir Singh Date: Wed, 17 Dec 2008 15:15:25 +0000 Subject: [PATCH] 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 git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@261 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- tests/libcgrouptest01.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 5eac5099..a6f23394 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); -- 2.47.2