summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:15:56 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:15:56 +0000
commitbe9bc9f12e399828a1a5292fd74f90507b55f836 (patch)
tree2dbf9ae6a7350f3442bcdf10ad72a7f5478a7032 /tests
parent97899c377dce7a4b9c655e1e5dcbb49a90525e31 (diff)
downloadlibcg-be9bc9f12e399828a1a5292fd74f90507b55f836.tar.gz
libcg-be9bc9f12e399828a1a5292fd74f90507b55f836.tar.xz
libcg-be9bc9f12e399828a1a5292fd74f90507b55f836.zip
libcgroup Test: libcgroup-modify_cgroup-test1-for-multimnt
This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for multiple mount scenario for first controller. The challenge is to handle the control value as diff controllers put diff upper limit on control value and we pick the controller dynamicaly. We are going to use a config file for that which will have the controller name, control file name and the control value. But not sure if there is any better approach. So thoughts ??? Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@262 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests')
-rw-r--r--tests/libcgrouptest01.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c
index a6f2339..4104157 100644
--- a/tests/libcgrouptest01.c
+++ b/tests/libcgrouptest01.c
@@ -23,6 +23,7 @@ int main(int argc, char *argv[])
/* In case of multimount for readability we use the controller name
* before the cgroup structure name */
struct cgroup *ctl1_cgroup1, *ctl2_cgroup1, *ctl2_cgroup2;
+ struct cgroup *mod_ctl1_cgroup1, *mod_ctl2_cgroup1, *mod_common_cgroup;
struct cgroup *common_cgroup;
char controller_name[FILENAME_MAX], control_file[FILENAME_MAX];
char path_group[FILENAME_MAX], path_control_file[FILENAME_MAX];
@@ -714,8 +715,41 @@ int main(int argc, char *argv[])
strncpy(extra, "\n", SIZE);
+
+ /*
+ * Create another valid cgroup structure with same group name
+ * to modify the existing group ctl1_group1
+ * Exp outcome: no error. 0 return value
+ */
+ strncpy(group, "ctl1_group1", sizeof(group));
+ retval = set_controller(ctl1, 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_ctl1_cgroup1 = new_cgroup(group, controller_name,
+ control_file, STRING);
+
+ /*
+ * Test09: modify existing cgroup with this new cgroup
+ * Exp outcome: zero return value and control value modified
+ */
+ build_path(path_control_file, mountpoint,
+ "ctl1_group1", control_file);
+
+ retval = cgroup_modify_cgroup(mod_ctl1_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);
+
/*
- * Test09: delete cgroups
+ * Test10: delete cgroups
* Exp outcome: zero return value
*/
retval = cgroup_delete_cgroup(ctl1_cgroup1, 1);