summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2008-07-01 13:45:51 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2008-07-01 13:45:51 +0000
commit2c4706487dee1138e7f76d9e188a7c9bbf4475ef (patch)
tree86e5a068cbbe65d1f7ff4b7df12c551e7d570e26
parentffaadffb864b22966c5adcd8f676755d00bf4d0f (diff)
downloadlibcg-2c4706487dee1138e7f76d9e188a7c9bbf4475ef.tar.gz
libcg-2c4706487dee1138e7f76d9e188a7c9bbf4475ef.tar.xz
libcg-2c4706487dee1138e7f76d9e188a7c9bbf4475ef.zip
From: Sudhir Kumar <skumar@linux.vnet.ibm.com>
libcgroup: libcgroup testcase for cgroup_init() This patch adds total 3 testcases for libcgroup API cgroup_init() testing.The API is called under the same three conditions(FS_MOUNTED=0/1/2) and return values are checked. Testcases for FS_MOUNTED=2 have to be updated and added. 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@88 4f4bb910-9a46-0410-90c8-c897d4f1cd53
-rw-r--r--tests/libcgrouptest01.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c
index fd4b915..05bf9d8 100644
--- a/tests/libcgrouptest01.c
+++ b/tests/libcgrouptest01.c
@@ -18,7 +18,7 @@
int main(int argc, char *argv[])
{
- int fs_mounted;
+ int fs_mounted, retval, i = 0;
if ((argc < 3) || (atoi(argv[1]) < 0)) {
printf("ERROR: Wrong no of parameters recieved from script\n");
@@ -36,20 +36,36 @@ int main(int argc, char *argv[])
switch (fs_mounted) {
case FS_NOT_MOUNTED:
+
/*
- * Test01: call apis and check return values
- * Exp outcome:
+ * Test01: call cgroup_init() and check return values
+ * Exp outcome: error ECGROUPNOTMOUNTED
*/
- printf("First set\n");
+
+ retval = cgroup_init();
+ if (retval == ECGROUPNOTMOUNTED)
+ printf("Test[0:%2d]\tPASS: cgroup_init() retval= %d:\n",\
+ ++i, retval);
+ else
+ printf("Test[0:%2d]\tFAIL: cgroup_init() retval= %d:\n",\
+ ++i, retval);
break;
case FS_MOUNTED:
+
/*
- * Test01: call apis and check return values
- * Exp outcome:
+ * Test01: call cgroup_init() and check return values
+ * Exp outcome: no error. return value 0
*/
- printf("Second set\n");
+
+ retval = cgroup_init();
+ if (retval == 0)
+ printf("Test[1:%2d]\tPASS: cgroup_init() retval= %d:\n",\
+ ++i, retval);
+ else
+ printf("Test[1:%2d]\tFAIL: cgroup_init() retval= %d:\n",\
+ ++i, retval);
break;
@@ -58,9 +74,21 @@ int main(int argc, char *argv[])
* Test01: call apis and check return values
* Exp outcome:
*/
- printf("Third set\n");
/*
- * Will add testcases once multiple mount patch is in
+ * Scenario 1: cgroup fs is multi mounted
+ * Exp outcome: no error. 0 return value
+ */
+
+ retval = cgroup_init();
+ if (retval == 0)
+ printf("Test[2:%2d]\tPASS: cgroup_init() retval= %d:\n",\
+ ++i, retval);
+ else
+ printf("Test[2:%2d]\tFAIL: cgroup_init() retval= %d:\n",\
+ ++i, retval);
+
+ /*
+ * Will add further testcases in separate patchset
*/
break;