summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:00:37 +0000
committerBalbir Singh <balbir@linux.vnet.ibm.com>2008-12-17 15:00:37 +0000
commite0289d87dfdab4c66c2dda8fc956a0965d0d7880 (patch)
treed79ec7323b251c6d67ca3e29663cb9d9225e957b /tests
parentb828e0424b82e1a6c74b2d68aae3d6da73f27809 (diff)
downloadlibcg-e0289d87dfdab4c66c2dda8fc956a0965d0d7880.tar.gz
libcg-e0289d87dfdab4c66c2dda8fc956a0965d0d7880.tar.xz
libcg-e0289d87dfdab4c66c2dda8fc956a0965d0d7880.zip
libcgroup Test: libcgrouptest-multimnt04
This patch adds a testcase for libcgroup API cgroup_delete_cgroup() testing. The API is called under the multimount condition(FS_MOUNTED=2) and return values are checked. The group is checked if it is deleted from the root directory of the corresponding controller's mountpoint. Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@244 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests')
-rw-r--r--tests/libcgrouptest01.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c
index 71dcec4..0140ad1 100644
--- a/tests/libcgrouptest01.c
+++ b/tests/libcgrouptest01.c
@@ -387,6 +387,8 @@ int main(int argc, char *argv[])
cgroup_free(&nullcgroup);
cgroup_free(&cgroup1);
+ cgroup_free(&cgroup2);
+ cgroup_free(&cgroup3);
break;
@@ -576,6 +578,48 @@ int main(int argc, char *argv[])
++i, retval);
}
+ /*
+ * Test09: delete cgroups
+ * Exp outcome: zero return value
+ */
+ retval = cgroup_delete_cgroup(cpu_cgroup1, 1);
+ if (!retval) {
+ /* Check if the group is deleted from the dir tree */
+ strncpy(path_group, mountpoint, sizeof(path_group));
+ strncat(path_group, "/cpugroup1", sizeof(path_group));
+ if (group_exist(path_group) == -1)
+ printf("Test[1:%2d]\tPASS: cgroup_delete_cgroup() retval=%d\n",
+ ++i, retval);
+ else
+ printf("Test[1:%2d]\tFAIL: group still found in fs\n", ++i);
+ } else {
+ printf("Test[1:%2d]\tFAIL: cgroup_delete_cgroup() retval=%d\n", ++i, retval);
+ }
+
+ /*
+ * Test09: delete other cgroups too
+ * Exp outcome: zero return value
+ */
+ retval = cgroup_delete_cgroup(mem_cgroup1, 1);
+ if (!retval) {
+ /* Check if the group is deleted from the dir tree */
+ strncpy(path_group, mountpoint, sizeof(path_group));
+ strncat(path_group, "/memgroup1", sizeof(path_group));
+ if (group_exist(path_group) == -1)
+ printf("Test[1:%2d]\tPASS: cgroup_delete_cgroup() retval=%d\n",
+ ++i, retval);
+ else
+ printf("Test[1:%2d]\tFAIL: group still found in fs\n", ++i);
+ } else {
+ printf("Test[1:%2d]\tFAIL: cgroup_delete_cgroup() retval=%d\n", ++i, retval);
+ }
+
+ /* Free the cgroup structures */
+ cgroup_free(&nullcgroup);
+ cgroup_free(&cpu_cgroup1);
+ cgroup_free(&mem_cgroup1);
+ cgroup_free(&mem_cgroup2);
+
break;
default: