From: Balbir Singh Date: Wed, 17 Dec 2008 15:09:32 +0000 (+0000) Subject: libcgroup Test: add warnings X-Git-Tag: v0.34~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6c94addf04ae6d515173b889877dd55b0072a39;p=thirdparty%2Flibcgroup.git libcgroup Test: add warnings 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 git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@253 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index a87f5763..85bcdd1c 100644 --- a/tests/libcgrouptest01.c +++ b/tests/libcgrouptest01.c @@ -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