summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:16:54 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:16:54 +0000
commit8eaae035d1762d5ab3624a7104f4154770434b00 (patch)
tree8f1b6bc11415b627ce0e205c1f9435d83cd3a3ca /tests
parent7c24ef00d7fc13b7c10147803d19293f2285caa5 (diff)
downloadlibcg-8eaae035d1762d5ab3624a7104f4154770434b00.tar.gz
libcg-8eaae035d1762d5ab3624a7104f4154770434b00.tar.xz
libcg-8eaae035d1762d5ab3624a7104f4154770434b00.zip
libcgroup Test: libcgroup-modify_cgroup-test3-for-multimnt
This patch adds a testcase for libcgroup api cgroup_modify_cgroup() for commongroup (under two controllers) in multiple mount scenario. 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 <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@264 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests')
-rw-r--r--tests/libcgrouptest01.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c
index 7b65fe4..e1c93e8 100644
--- a/tests/libcgrouptest01.c
+++ b/tests/libcgrouptest01.c
@@ -930,7 +930,73 @@ int main(int argc, char *argv[])
strncpy(extra, "\n", SIZE);
/*
- * Test13: delete this common cgroup
+ * Test13: Create a valid cgroup structure to modify the
+ * commongroup which is under multiple controllers
+ * Exp outcome: no error. 0 return value
+ */
+ strncpy(group, "commongroup", sizeof(group));
+ strncpy(val_string, "7000000", sizeof(val_string));
+ retval = set_controller(ctl1, controller_name, control_file);
+
+ if (retval) {
+ fprintf(stderr, "Setting controller failled "
+ " Exiting without running further testcases\n");
+ exit(1);
+ }
+
+ mod_common_cgroup = new_cgroup(group, controller_name,
+ control_file, STRING);
+
+ /* Add one more controller to the cgroup */
+ retval = set_controller(ctl2, controller_name, control_file);
+ if (retval) {
+ fprintf(stderr, "Setting controller failled "
+ " Exiting without running further testcases\n");
+ exit(1);
+ }
+ if (!cgroup_add_controller(mod_common_cgroup, controller_name))
+ message(++i, FAIL, "add_controller()", retval, extra);
+
+ /*
+ * Test14: modify existing cgroup with this new cgroup
+ * Exp outcome: zero return value and control value modified
+ */
+
+ strncpy(extra, " Called with commongroup. ", SIZE);
+ retval = cgroup_modify_cgroup(mod_common_cgroup);
+ /* Check if the values are changed */
+ if (!retval) {
+ build_path(path_control_file, mountpoint,
+ "commongroup", control_file);
+ if (!group_modified(path_control_file, STRING)) {
+ build_path(path_control_file, mountpoint2,
+ "commongroup", control_file);
+ if (!group_modified(path_control_file, STRING)) {
+ strncat(extra, " group modified under"
+ " both controllers\n", SIZE);
+ message(++i, PASS, "modify_cgroup()",
+ retval, extra);
+ } else {
+ strncat(extra, " group not modified "
+ "under 2nd controller\n", SIZE);
+ message(++i, FAIL, "modify_cgroup()",
+ retval, extra);
+ }
+ } else {
+ strncat(extra, " group not modified under any "
+ "controller\n", SIZE);
+ message(++i, FAIL, "modify_cgroup()",
+ retval, extra);
+ }
+ } else {
+ strncat(extra, "\n", sizeof("\n"));
+ message(++i, FAIL, "modify_cgroup()", retval, extra);
+ }
+
+ strncpy(extra, "\n", SIZE);
+
+ /*
+ * Test15: delete this common cgroup
* Exp outcome: zero return value
*/
strncpy(extra, " Called with commongroup. ", SIZE);