diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-12-17 15:09:32 +0000 |
---|---|---|
committer | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-12-17 15:09:32 +0000 |
commit | e6c94addf04ae6d515173b889877dd55b0072a39 (patch) | |
tree | ec257254794db3aaaa771d687ef9a74869324d15 /tests/libcgrouptest01.c | |
parent | 042081a6779d0ae415d06a25ebbff92ef2b59e2c (diff) | |
download | libcg-e6c94addf04ae6d515173b889877dd55b0072a39.tar.gz libcg-e6c94addf04ae6d515173b889877dd55b0072a39.tar.xz libcg-e6c94addf04ae6d515173b889877dd55b0072a39.zip |
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 <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@253 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests/libcgrouptest01.c')
-rw-r--r-- | tests/libcgrouptest01.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index a87f576..85bcdd1 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 |