From: Balbir Singh Date: Wed, 17 Dec 2008 15:13:13 +0000 (+0000) Subject: libcgroup Test: set-another-controller-if-first-fails X-Git-Tag: v0.34~180 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=484250af210a51f906503c876b9f92e2b2a31f35;p=thirdparty%2Flibcgroup.git libcgroup Test: set-another-controller-if-first-fails This patch adds a warning in case setting a controller fails and tries to set values for another controller. Signed-off-by: Sudhir Kumar git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@258 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 8c5126ae..14513eb6 100644 --- a/tests/libcgrouptest01.c +++ b/tests/libcgrouptest01.c @@ -334,8 +334,17 @@ int main(int argc, char *argv[]) retval = set_controller(MEMORY, controller_name, control_file); strncpy(val_string, "81920000", sizeof(val_string)); - if (retval) - fprintf(stderr, "Setting controller failled\n"); + if (retval) { + fprintf(stderr, "Failed to set first controller. " + "Trying with second controller\n"); + retval = set_controller(CPU, controller_name, + control_file); + strncpy(val_string, "4096", sizeof(val_string)); + if (retval) + fprintf(stderr, "Failed to set any controllers " + "Tests dependent on this structure will" + " fail\n"); + } cgroup2 = new_cgroup(group, controller_name, control_file, STRING); @@ -379,7 +388,8 @@ int main(int argc, char *argv[]) strncpy(group, "group1", sizeof(group)); retval = set_controller(CPU, controller_name, control_file); if (retval) - fprintf(stderr, "Setting controller failled\n"); + fprintf(stderr, "Setting controller failled. " + "Tests dependent on this struct may fail\n"); cgroup3 = new_cgroup(group, controller_name, control_file, INT64); @@ -392,7 +402,6 @@ int main(int argc, char *argv[]) "different controller\n", SIZE); build_path(path_control_file, mountpoint, "group1", control_file); - strncpy(val_string, "2048", sizeof(val_string)); retval = cgroup_modify_cgroup(cgroup3); /* Check if the values are changed */