]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
libcgroup Test: add warnings
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Wed, 17 Dec 2008 15:09:32 +0000 (15:09 +0000)
committerBalbir Singh <balbir@linux.vnet.ibm.com>
Wed, 17 Dec 2008 15:09:32 +0000 (15:09 +0000)
Hi,
This patch adds some warnings in case some testcses fail.
When we modify a group with nullcgroup then there is no need to
check if values are changed.

Signed-off-by: Sudhir Kumar <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@253 4f4bb910-9a46-0410-90c8-c897d4f1cd53

tests/libcgrouptest01.c

index a87f5763bf746d0802ef7ec3660aab25b3b02527..85bcdd1c533d9695a796e766de9e81157a6ba212 100644 (file)
@@ -243,6 +243,8 @@ int main(int argc, char *argv[])
                strncpy(val_string, "40960000", sizeof(val_string));
 
                if (retval) {
+                       fprintf(stderr, "Failed to set memory controller. "
+                                               "Trying with cpu controller\n");
                        retval = set_controller(CPU, controller_name,
                                                                control_file);
                        strncpy(val_string, "2048", sizeof(val_string));
@@ -269,12 +271,16 @@ int main(int argc, char *argv[])
                                message(++i, PASS, "create_cgroup()",
                                                                 retval, extra);
                        } else {
-                               strncpy(extra, " grp not found in fs\n", SIZE);
+                               strncpy(extra, " grp not found in fs. "
+                                               "tests dependent on this"
+                                               " grp will fail\n", SIZE);
                                message(++i, FAIL, "create_cgroup()",
                                                                 retval, extra);
                        }
 
                } else {
+                       strncpy(extra, " Tests dependent on this grp "
+                                                       "will fail\n", SIZE);
                        message(++i, FAIL, "create_cgroup()", retval, extra);
                }
                strncpy(extra, "\n", SIZE);
@@ -324,17 +330,14 @@ int main(int argc, char *argv[])
 
                /*
                 * Test09: modify cgroup with the null cgroup
-                * Exp outcome: zero return value. root group unchanged.
+                * Exp outcome: zero return value.
                 */
 
                strncpy(extra, " Called with NULL cgroup argument\n", SIZE);
-               strncpy(path_control_file, mountpoint, sizeof(mountpoint));
-               strncat(path_control_file, "/", sizeof("/"));
-               strncat(path_control_file, control_file, sizeof(control_file));
 
                retval = cgroup_modify_cgroup(nullcgroup);
-               /* Check if the values are changed */
-               if (!retval && !group_modified(path_control_file, STRING))
+               /* No need to check if the values are changed */
+               if (retval == ECGINVAL)
                        message(++i, PASS, "modify_cgroup()", retval, extra);
                else
                        message(++i, FAIL, "modify_cgroup()", retval, extra);
@@ -359,6 +362,9 @@ int main(int argc, char *argv[])
                 * Test10: modify existing group with this cgroup
                 * Exp outcome: zero return value
                 */
+               strncpy(extra, " Called with a cgroup argument with "
+                                               "different controller\n", SIZE);
+
                strncpy(path_control_file, mountpoint, sizeof(mountpoint));
                strncat(path_control_file, "/group1", sizeof("/group2"));
                strncat(path_control_file, "/", sizeof("/"));
@@ -373,6 +379,8 @@ int main(int argc, char *argv[])
                else
                        message(++i, FAIL, "modify_cgroup()", retval, extra);
 
+               strncpy(extra, "\n", SIZE);
+
                /*
                 * Test11: delete cgroup
                 * Exp outcome: zero return value