diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-12-17 15:13:13 +0000 |
---|---|---|
committer | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-12-17 15:13:13 +0000 |
commit | 484250af210a51f906503c876b9f92e2b2a31f35 (patch) | |
tree | 692042eb54b9b1e7bc0f788f517102ba0ea83d70 /tests/libcgrouptest01.c | |
parent | 2dd99bc9f1a2b3eea466a4c03cc2457fe1948fc2 (diff) | |
download | libcg-484250af210a51f906503c876b9f92e2b2a31f35.tar.gz libcg-484250af210a51f906503c876b9f92e2b2a31f35.tar.xz libcg-484250af210a51f906503c876b9f92e2b2a31f35.zip |
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 <skumar@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@258 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'tests/libcgrouptest01.c')
-rw-r--r-- | tests/libcgrouptest01.c | 17 |
1 files changed, 13 insertions, 4 deletions
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 */ |