diff options
author | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2008-07-01 13:54:34 +0000 |
---|---|---|
committer | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2008-07-01 13:54:34 +0000 |
commit | 3c0aafb5e5db7f91ce379e43841debcd325cc50e (patch) | |
tree | 0243293c62a02d6c299dac7d38ee5af7c095b8f9 | |
parent | 952183580cc874db99230534f7e38b75f57f3d88 (diff) | |
download | libcg-3c0aafb5e5db7f91ce379e43841debcd325cc50e.tar.gz libcg-3c0aafb5e5db7f91ce379e43841debcd325cc50e.tar.xz libcg-3c0aafb5e5db7f91ce379e43841debcd325cc50e.zip |
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>
libcgroup: further testcases for create_cgroup() and delete_cgroup()
This patch adds testcases for libcgroup API cgroup_create_cgroup() and
cgroup_delete_cgroup() testing. The APIs are called under the same but two
conditions(FS_MOUNTED=0/1) and return values are checked. The test checks if
these APIs can handle a null cgroup and hence passes a nulll cgroup as
parameter.
Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@91 4f4bb910-9a46-0410-90c8-c897d4f1cd53
-rw-r--r-- | tests/libcgrouptest01.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 0c4d20b..cbe4634 100644 --- a/tests/libcgrouptest01.c +++ b/tests/libcgrouptest01.c @@ -131,6 +131,25 @@ int main(int argc, char *argv[]) else printf("Test[0:%2d]\tFAIL: cgroup_delete_cgroup() retval=%d\n", ++i, retval); + /* + * Test06: Check if cgroup_create_cgroup() handles a NULL cgroup + * Exp outcome: error ECGINVAL + */ + retval = cgroup_create_cgroup(nullcgroup, 1); + if (retval) + printf("Test[0:%2d]\tPASS: cgroup_create_cgroup() nullcgroup handled\n", ++i); + else + printf("Test[0:%2d]\tFAIL: cgroup_create_cgroup() nullcgroup not handled\n", ++i); + + /* + * Test07: delete nullcgroup + */ + retval = cgroup_delete_cgroup(nullcgroup, 1); + if (retval) + printf("Test[0:%2d]\tPASS: cgroup_delete_cgroup() nullcgroup handled\n", ++i); + else + printf("Test[0:%2d]\tFAIL: cgroup_delete_cgroup() Unable to handle nullcgroup\n", ++i); + cgroup_free(&nullcgroup); cgroup_free(&cgroup1); @@ -271,6 +290,25 @@ int main(int argc, char *argv[]) } else printf("Test[1:%2d]\tFAIL: cgroup_delete_cgroup() retval=%d\n", ++i, retval); + /* + * Test08: Check if cgroup_create_cgroup() handles a NULL cgroup + * Exp outcome: error ECGINVAL + */ + retval = cgroup_create_cgroup(nullcgroup, 1); + if (retval) + printf("Test[1:%2d]\tPASS: cgroup_create_cgroup() nullcgroup handled\n", ++i); + else + printf("Test[1:%2d]\tFAIL: cgroup_create_cgroup() nullcgroup not handled\n", ++i); + + /* + * Test09: delete nullcgroup + */ + retval = cgroup_delete_cgroup(nullcgroup, 1); + if (retval) + printf("Test[1:%2d]\tPASS: cgroup_delete_cgroup() nullcgroup handled\n", ++i); + else + printf("Test[1:%2d]\tFAIL: cgroup_delete_cgroup() Unable to handle nullcgroup\n", ++i); + cgroup_free(&nullcgroup); cgroup_free(&cgroup1); |