]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>
authorDhaval Giani <dhaval@linux.vnet.ibm.com>
Tue, 1 Jul 2008 13:54:34 +0000 (13:54 +0000)
committerDhaval Giani <dhaval@linux.vnet.ibm.com>
Tue, 1 Jul 2008 13:54:34 +0000 (13:54 +0000)
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

tests/libcgrouptest01.c

index 0c4d20bab658dec9ea185eeb2a9b0d5a436c1893..cbe4634e4035bc877999622eb56f3fdb998968cf 100644 (file)
@@ -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);