From 484250af210a51f906503c876b9f92e2b2a31f35 Mon Sep 17 00:00:00 2001 From: Balbir Singh Date: Wed, 17 Dec 2008 15:13:13 +0000 Subject: 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 --- tests/libcgrouptest01.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'tests/libcgrouptest01.c') diff --git a/tests/libcgrouptest01.c b/tests/libcgrouptest01.c index 8c5126a..14513eb 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 */ -- cgit