From 7c24ef00d7fc13b7c10147803d19293f2285caa5 Mon Sep 17 00:00:00 2001 From: Balbir Singh Date: Wed, 17 Dec 2008 15:16:20 +0000 Subject: libcgroup Test: libcgroup-modify_cgroup-test2-for-multimnt 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 git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@263 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- tests/libcgrouptest01.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 4104157..7b65fe4 100644 --- a/tests/libcgrouptest01.c +++ b/tests/libcgrouptest01.c @@ -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); -- cgit